Re: [R] Looking for a more elegant solution than a loop

2015-10-26 Thread Erin Hodgess
roject.org] On Behalf Of Erin > > Hodgess > > Sent: October 26, 2015 9:32 PM > > To: R help <r-h...@stat.math.ethz.ch> > > Subject: [R] Looking for a more elegant solution than a loop > > > > Hello! > > > > The following (which is a toy example

Re: [R] Looking for a more elegant solution than a loop

2015-10-26 Thread Fox, John
t; From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Erin > Hodgess > Sent: October 26, 2015 9:32 PM > To: R help <r-h...@stat.math.ethz.ch> > Subject: [R] Looking for a more elegant solution than a loop > > Hello! > > The following (which is a toy example) wo

Re: [R] Looking for a more elegant solution than a loop

2015-10-26 Thread William Dunlap
> identical(as.list(x), xz) [1] TRUE Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Oct 26, 2015 at 6:31 PM, Erin Hodgess wrote: > Hello! > > The following (which is a toy example) works fine, but I wonder if there is > a better or more elegant way than to do the

[R] Looking for a more elegant solution than a loop

2015-10-26 Thread Erin Hodgess
Hello! The following (which is a toy example) works fine, but I wonder if there is a better or more elegant way than to do the loop: xz <- vector("list",length=4) x <- 6:9 for(i in 1:4)xz[[i]] <- x[i] xz [[1]] [1] 6 [[2]] [1] 7 [[3]] [1] 8 [[4]] [1] 9 This does exactly what I want, but