Re: [R] How to use an elements' name when creating a data frame via a for loop

2014-04-07 Thread arun
Hi, It is not clear what you really want.  Now, you mentions ?merge() etc.  If you don't want to use ?assign(), lst <- list(as.data.frame(matrix(1:40,ncol=5)), as.data.frame(matrix(1:20,ncol=4)), as.data.frame(matrix(1:25,ncol=5)),as.data.frame(matrix(21:30,ncol=2)))  stations <- c("BETB0

Re: [R] How to use an elements' name when creating a data frame via a for loop

2014-04-07 Thread arun
Hi, May be this helps: stations <- LETTERS[1:4] set.seed(42) PM2.5 <- data.frame(DateTime=seq(as.POSIXct("2010-01-10 01:00:00"),length.out=10,by= "1 day"), station= sample(LETTERS[1:4],10,replace=TRUE)) for(i in 1:length(stations)) assign(paste(stations[i],"PM",sep="_"),subset(PM2.5,station==sta