[R] write list ascii file

Jim Holtman jholtman at gmail.com
Thu Jul 19 12:11:57 CEST 2012


what is that you want to do with this data after it is written?  you can easily write a function using 'cat' to create any format that you want.

Sent from my iPad

On Jul 19, 2012, at 5:09, Skála, Zdeněk (INCOMA GfK)<Zdenek.Skala at gfk.com> wrote:

> Dear all,
> apologies for this (perhaps recurrent) question but I did not found a question when searching mailing lists.
> 
> How to write a list of a simple kind, e.g.:
> 
> abc <- list(one=(1:2), two=(1:5))
> 
> # to a file? I understand that write() & co. cannot work but when I try
> 
> sink("aa.txt", append=T, split=T)
> abc
> sink()
> 
> # the output is indeed "split by rows" in the textfile, each starting with row numbers (and I have rather long "vectors" resulting in many rows...):
> 
> $one
> [1] 1 2
> 
> $two
> [1] 1 2 3 4 5
> 
> What I would need is a simple "set of vectors" starting with name in the style of:
> $one 1 2
> $two 1 2 3 4 5
> 
> Is it possible in R?
> 
> Many thanks!
> 
> Zdenek Skala
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list