Re: [R] Print/Save/Cat/Write list

From: jim holtman <jholtman_at_gmail.com>
Date: Sat 30 Sep 2006 - 14:18:32 GMT

try:

sink("y.data")
y
sink()

On 9/30/06, Ritwik Sinha <ritwik.sinha@gmail.com> wrote:
> Hi,
>
> I would like to write a list to an ascii file.
> I tried the following
>
> y <- list(a = 1, b = c(TRUE,FALSE), c = "oops")
> save(y, file="y.data", ascii=TRUE)
> # Not satisfactory
>
> print does not have a file="" option
> cat cannot handle lists.
> write does not handle lists
> write.table converts it to a d.f
>
> Perhaps I could loop through the elements of a list and keep appending
> its elements to a file, but that will have a problem if any of the
> elements of the list is a list. I suppose there must be a simple
> function that does what I need. Sorry if I have missed anything
> obvious, my searches did not return anything useful.
>
> Thanks and regards,
> Ritwik.
>
> Here is my version
>
> platform i686-redhat-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> status
> major 2
> minor 2.1
> year 2005
> month 12
> day 20
> svn rev 36812
> language R
>
> --
> Ritwik Sinha
> Graduate Student
> Epidemiology and Biostatistics
> Case Western Reserve University
> ritwik.sinha_at_gmail.com | +12163682366 | http://darwin.cwru.edu/~rsinha
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Sun Oct 01 00:23:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 30 Sep 2006 - 15:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.