I am trying to write all the dataframes from a list to a csv conserving the name of the list and I am not sure what am i doing wrong. This is what I am trying as seen here :
v1<-c(0:9)
v2<-c(10:19)
v3<-c(20:29)
v4<-c(30:39)
v5<-c(40:49)
v6<-c(50:59)
lista<- cbind(v1, v2, v3)
listb<- cbind(v4, v5, v6)
list<- list(lista, list)
for (i in seq_along(list)) {
filename = paste(names(list)[i], ".csv")
write.csv(data[[i]], filename)
}
However I get this error Error in data[[i]] : object of type 'closure' is not subsettable
.
I know this has been asked before buy I have tried everything I could find.
Many thanks!