Dear readers,

I have one file look like
ew;ns;cu;zn
1234567;7654321;23.4;13.7
name indata
load with read.table command

another file look like
2;cu;zn
name parmlst
also load with read.table

I want to do as follows

cu.v <- as.vector(cu)
zn.v<- as.vector(zn)
 
but using a for loop, like

for (i in 1:2)
{
some good code for generating file name <- as.vector(some good code)
#cu and zn in file name extracting value for cu and zn from indata
}


I have try almost everyting, using
paste()
noquote()
but it won't work, can only extract cu not the value 23.4 in the as.vector 
operation
this 
> noquote(paste(parmlst[[i+4]],".v",sep="")) <- 
as.vector(eval(noquote(paste(parmlst[[i+4]]))))
Error in noquote(paste(parmlst[[i + 4]], ".v", sep = "")) <- 
as.vector(eval(noquote(paste(parmlst[[i +  : 
  could not find function "noquote<-"
- - - - - - - - - - - -
> test.v <- as.vector(noquote(paste(parmlst[[i+4]])))
> print(test.v)
[1] "zn"
when it should be 13.7

Running R 2.8.0 on Win NT


Regards,
Mikael


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to