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="")
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
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
3 matches
Mail list logo