Hi everyone, I try to add many vectors (L1,L2,L3....) to many list objects (a.list, b.list....) in a workspace. Somethings like below, but it is not working. Any suggestions will be appreciated. Best, John
lf=ls(pattern=".lst") for (x in listfiles) { dat=read.delim(x,header=F) for (i in 1: lf) { assign(i$add,as.numeric(dat[,3])) #or i$add=as.numeric(dat[,3] names(i)[names(i)=="add"]=substr(x,1,5) print (i[1:3,]) } } [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.