I am relatively new to R, and have the below problem:
- I have a list of dataframes in R which was generated through lapply and cbind funtion (code mentioned below - it works fine):
res<-lapply(1:35,function(i){cbind(df1[i],df2[i],df3[i])})
This has generated list of 35 dataframes each containing list[72*3](S3: data.frame)
Next what i want to do is, save each of these dataframes assigning separate names to it. The names would be specific dates retrieved from an already stored list. The below is the code for it:
for (i in 1:length(res)) { a<-res[[i]] for (j in as.list(Date.table)){ newname<-paste(j) d<-data.frame(a) names(d)<-c("RIC","MV","BVMV") assign(newname,d) } }
While 35 dataframes are being generated with different dates, the data in all these dataframes is the same i.e. of the last dataframe.
Could somebody please point out the error in the code to resolve this. It is essentially not saving each dataframe but saving only the last one.
Many thanks!!!