Re: [R] create arrays

2011-05-06 Thread Daniel Nordlund
: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of adele_thomp...@cargill.com > Sent: Friday, May 06, 2011 12:18 PM > To: greg.s...@imail.org; r-help@r-project.org > Subject: Re: [R] create arrays > > Beautiful. > > -Original Message-

Re: [R] create arrays

2011-05-06 Thread Adele_Thompson
Beautiful. -Original Message- From: greg.s...@imail.org [mailto:greg.s...@imail.org] Sent: Friday, May 06, 2011 02:17 PM To: Thompson, Adele - adele_thomp...@cargill.com; r-help@r-project.org Subject: RE: [R] create arrays ?seq -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

Re: [R] create arrays

2011-05-06 Thread Joshua Wiley
On Fri, May 6, 2011 at 12:11 PM, Schatzi wrote: > In Matlab, an array can be created from 1 - 30 using the command similar to R > which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30 > which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R? Hmm, in this case, I would do it

Re: [R] create arrays

2011-05-06 Thread Greg Snow
2 PM > To: r-help@r-project.org > Subject: [R] create arrays > > In Matlab, an array can be created from 1 - 30 using the command > similar to R > which is 1:30. Then, to make the array step by 0.1 the command is > 1:0.1:30 > which is 1, 1.1, 1.2,...,29.9,30. How can I

Re: [R] create arrays

2011-05-06 Thread David Wolfskill
On Fri, May 06, 2011 at 12:11:30PM -0700, Schatzi wrote: > In Matlab, an array can be created from 1 - 30 using the command similar to R > which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30 > which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R? > ... This may well be a

Re: [R] create arrays

2011-05-06 Thread Schatzi
I can get around it by doing something like: as.matrix(rep(1,291))*row(as.matrix(rep(1,291)))/10+.9 I was just hoping for a simple command. Schatzi wrote: > > In Matlab, an array can be created from 1 - 30 using the command similar > to R which is 1:30. Then, to make the array step by 0.1 the c

[R] create arrays

2011-05-06 Thread Schatzi
In Matlab, an array can be created from 1 - 30 using the command similar to R which is 1:30. Then, to make the array step by 0.1 the command is 1:0.1:30 which is 1, 1.1, 1.2,...,29.9,30. How can I do this in R? - In theory, practice and theory are the same. In practice, they are not - Albert

Re: [R] Create Arrays

2010-10-15 Thread dpender
Hi Gerrit, Almost it but I need to insert M[,i] as well as (matrix( -1, nrow( M), CN[i]) when CN[i] = 0 I know this is not correct but can something like the following be done? HH <- c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) TT <- c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32, 7.14, 7.14,

Re: [R] Create Arrays

2010-10-15 Thread Gerrit Eichner
Hi, Doug, maybe HH <- c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) TT <- c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32, 7.14, 7.14, 7.14) columnnumbers <- c(0, 0, 0, 3, 0, 0, 0, 2, 0) TMP <- lapply( seq( columnnumbers), function( i, CN, M) { if( CN[i] == 0) as.

Re: [R] Create Arrays

2010-10-15 Thread dpender
Barry, Gerrit, That was what I am after but unfortunately only the starting point. I am now trying to amend a function that inserts the R matrices into a dataset in the correct places: i.e. H <- c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) T <- c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32,

Re: [R] Create Arrays

2010-10-15 Thread Gerrit . Eichner
Hi, Doug, maybe columns <- c( 0, 3, 0, 2, 0, 1) lapply( columns[ columns > 0], function( o) array( -1, dim = c( 2, o))) does what you want? Regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical Institu

Re: [R] Create Arrays

2010-10-15 Thread Barry Rowlingson
On Fri, Oct 15, 2010 at 9:55 AM, dpender wrote: > > Hi, > > For this example: > > O <- c(0 0 0 2 0 0 2 0) > > I want to create an array every time O[i] > 0.  The array should be in the > form; > > R[j] <- array(-1, dim=c(2,O[i])) > > i.e. if O[i] > 0 4 times I want 4 R arrays. > > Does anyone have

[R] Create Arrays

2010-10-15 Thread dpender
Hi, For this example: O <- c(0 0 0 2 0 0 2 0) I want to create an array every time O[i] > 0. The array should be in the form; R[j] <- array(-1, dim=c(2,O[i])) i.e. if O[i] > 0 4 times I want 4 R arrays. Does anyone have any suggestions? Thanks, Doug -- View this message in context: htt