Re: [R] Create a matrix with increment and element with zero subscript

2011-10-25 Thread Md Desa, Zairul Nor Deana Binti
Thanks, all! I've tried changing the start and end of the loop and I tried cbind initial column with the other columns to get the matrix I want. It did work! Thanks also for the note about the parentheses. It real useful. I'll try Oarray if that would fasten the iteration. Thanks again! Deana

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-25 Thread R. Michael Weylandt
Fair enough -- hadn't thought of going the other way. I do remember looking at that C trick once, but I'm actually somewhat surprised Fortan has it natively: I had always associated multiple basing with something like VBA that has to keep everyone on board but no one happy. Seems a surprisingly fle

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-25 Thread S Ellison
R. Michael Weylandt wrote: > > This may be an unnecessary aside, but other than obfuscating > code or allowing people to never stop thinking in C and start > thinking in R, what practical purpose would this package > serve in an R context? > I'd think about constructs like income[1990:2010]

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-25 Thread R. Michael Weylandt
This may be an unnecessary aside, but other than obfuscating code or allowing people to never stop thinking in C and start thinking in R, what practical purpose would this package serve in an R context? Michael On Mon, Oct 24, 2011 at 11:31 PM, Ben Bolker wrote: > Md Desa, Zairul Nor Deana Binti

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Ben Bolker
Md Desa, Zairul Nor Deana Binti ku.edu> writes: > > Hello, > Does anyone knows how to deal with zero subscript in R. Try the "Oarray" package (that's a capital letter "O"). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 7:23 PM, Md Desa, Zairul Nor Deana Binti wrote: Hello, Does anyone knows how to deal with zero subscript in R. I have this code: for (i in 1:nitems){ + for (j in 1:ncat-1) { + draw<-matrix(rnorm(nitems*(ncat-1),seed1,seed2),nitems, (ncat-1)) +

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Joshua Wiley
Hi Deana, No, R does not deal with zero subscripts. Could it be done? Of course. The simplest approach is: 0 + 1 = 1, which is the R equivalent. You need to adjust your code to go, for example, from 1 to 30 instead of 0 to 29. Cheers, Josh On Mon, Oct 24, 2011 at 4:23 PM, Md Desa, Zairul No

[R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Md Desa, Zairul Nor Deana Binti
Hello, Does anyone knows how to deal with zero subscript in R. I have this code: for (i in 1:nitems){ + for (j in 1:ncat-1) { + draw<-matrix(rnorm(nitems*(ncat-1),seed1,seed2),nitems,(ncat-1)) + d<-( sigma_d*draw ) + mu_d + draw<-matrix(rtnorm((nitems*(ncat-1)