Re: [R] assign question

2009-07-20 Thread Albyn Jones
I don't think you want assign() here. > x1 = rnorm(20) > min(x1) [1] -0.9723398 > min(eval(paste("x",1,sep=""))) # not the solution [1] "x1" > min(eval(as.name(paste("x",1,sep="" # a solution [1] -0.9723398 try: for(i in 1:27) { xener[i] <- min(eval(as.name((paste("sa",i,sep="")

Re: [R] assign question

2009-07-20 Thread David Huffer
an CSOSA/Washington, DC david.huf...@csosa.gov - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erin Hodgess Sent: Monday, July 20, 2009 2:26 PM To: R help Subject: [R] a

[R] assign question

2009-07-20 Thread Erin Hodgess
Dear R People: I have several vectors, sa1, sa2,...sa27 of varying lengths. I want to produce one vector xener[1:27] which has the minimum of each sa[i]. I'm trying to set up a loop and use the assign statement, but here are my results: > for(i in 1:27) { + xener[i] <- min(assign(paste("sa",i,s