Using lapply to apply a function over list of data frames and saving output to files with different names
It will work with the following lapply
call:
lapply(names(mylist), function(x) NewVar(mylist[[x]], "y", x))
There are many options. For example:
lapply(names(mylist),
function(x)write.csv(mylist[x],
file =paste0(x,'.csv')))
or using indexes :
lapply(seq_along(mylist),
function(i)write.csv(mylist[i],
file =paste0(names(mylist)[i],'.csv')))