Re: [R] Sampling from a Matrix

2006-08-10 Thread Daniel Gerlanc
it would be up to Daniel for clarification. Regards, Marc -- Daniel Gerlanc Williams College '07 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

[R] Vectorizing a for loop

2006-08-03 Thread Daniel Gerlanc
Hello all, Consider the following problem: There are two vectors: rows - c(1, 2, 3, 4, 5) columns - c(10, 11, 12, 13, 14) I want to create a matrix with dimensions length(rows) x length(columns): res - matrix(nrow = length(rows), ncol = length(columns)) If i and j are the row and column

[R] How to split the left and right hand terms of a formula

2006-07-26 Thread Daniel Gerlanc
Hello All, I've sent a few messages to the list regarding splitting a formula into its right and left hand terms. Thanks to everyone who has responded. I believe that the best way to extract the left and right hand terms as character vectors follows: library(nlme) formula - y ~ x + z

[R] Follow Up To: Splitting the left and right hand terms of a formula

2006-07-25 Thread Daniel Gerlanc
Hi All, I sent the following message to R-help on July 14th, 2006: Let's say I have the following formula: a.formula - x ~ y + z I want to extract the left and right-hand sides of the function so that I have two character vectors like the ones you would create using the following assignments:

[R] Splitting the left and right hand terms of a formula

2006-07-14 Thread Daniel Gerlanc
this follows: left.hand.side - unlist(dimnames(attr(terms(a.formula), factors))[1]) right.hand.side - unlist(dimnames(attr(terms(a.formula), factors))[-1]) Is there a better or cleaner way to do this? Thanks! Daniel Gerlanc Williams College '07 __ R-help