What I am trying to do is to add columns to a data frame but I don't want to write for each column
please consider this example :
for (i in 1:nrow(b){
dataframe$i<-dataframe1[i,2] }
what I am trying to do is to add a column for each loop and assign a name which contain a string and i, is there anyway to do that ?
EDIT :what if the dataframe is a list : please consider this example
I<-list()
for(j in 1:nrow(a)){
I[[j]]<-data.frame(d=1,c=2,d=4.01,stringsAsFactors=FALSE)
for (i in 1:nrow(b)){
I[[j]][[paste0("F",i)]]<-dataframe1[i,2]}}
error for this code : object of type 'closure' is not subsettable
thank you in advance