Re: [R] importing a list

From: Marc Schwartz (via MN) <>
Date: Thu 11 May 2006 - 04:41:02 EST

On Wed, 2006-05-10 at 13:19 -0500, Marc Schwartz (via MN) wrote:
> A search for the list2ascii() function, led me to this post by Mike
> Prager:
> in which Mike specifically notes:
> "To write it to a file that can be read by R, I would suggest using
> "dput" instead."
> Thus, instead of using list2ascii() on your list object, use:
> sink("YourTextFile")
> dput(YourListObject)
> sink()
> You can then re-read the text file back into R using:
> source("YourTextFile")

Actually, quick correction here. That should be:

  NewListObject <- dget("YourTextFile")

dget() will enable simple assignment of the textual input, whereas source() will just evaluate it and assignment with source() creates a list object, unless you use:   

  NewListObject <- source("YourTextFile")$value

Marc mailing list PLEASE do read the posting guide! Received on Thu May 11 04:44:23 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 Thu 11 May 2006 - 06:10:04 EST.

Mailing list information is available at Please read the posting guide before posting to the list.