In the same context I tried the following but with no results. mywrite=function(a,b){ write.csv(a,paste(b,".csv") } lapply(age,mywrite(age,names))
which produced: Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'list') cannot be handled by 'cat' Thanks once again. Raghu On Sat, Jul 14, 2012 at 3:22 PM, Raghuraman Ramachandran < optionsra...@gmail.com> wrote: > GuRus > > How do I use the write function (or write.table or write.csv) to achieve > the following please? > > age=c(32,37,39) > names=c("john","peter","jake") > > I would like create in a directory 3 files each named as > john.csv,peter.csv and jake.csv and each file have data from the age > vector. That is jon.csv will contain 32, peter.csv will contain 37 and > jake.csv will contain 39. > > Thanks for the help. > > Raghu > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.