My code is as follows:
x<-read.table('1') y<-read.table('2') z<-read.table('2') MyFunc<-function (data){ plot(data[1]~data[2]) title(main=substitute(data)) data.new <- some.manipulations(data) write.csv(data.new,file=paste(substitute(data),".csv",sep="")) } my.list <- list(x,y,z) lapply(mylist,MyFunc) I want this to generate a graph and a .csv file for 25 or so different tables. It works fine if I call it individually - for example if I execute:
MyFunc(x) I get a graph titled "x" and a file x.csv My problem is I need to do this many times, and when I put all of my tables in a list and try using lapply or sapply, each table somehow loses it's name so the graph has no title and the file isn't created because blank.csv isn't a viable file name. I also tried concatenating the objects:
my.list <- c(x,y,z) This yielded the same issue. Any help would be much appreciated!