[R] writing data into files whose names are in a vector

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sat Jul 14 16:51:19 CEST 2012

You have to wrap the write calls in some kind of loop. For your example, you could use a for loop. If you have multiple rows of one name you might look into the dlply function from the plyr package and use lapply to do the actual write calls. 
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

Raghuraman Ramachandran <optionsraghu at gmail.com> wrote:

>How do I use the write function (or write.table or write.csv) to
>the following please?
>I would like create in a directory 3 files each named as
>and jake.csv and each file have data from the age vector. That is
>will contain 32, peter.csv will contain 37 and jake.csv will contain
>Thanks for the help.
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list