[R] importing a list
grazia at stat.columbia.edu
grazia at stat.columbia.edu
Wed May 10 20:00:30 CEST 2006
Marc,
it's perfect!!!!
THANKS a lot for your help.
grazia
On Wed, 10 May 2006, Marc Schwartz (via MN) wrote:
> 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:
>>
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66335.html
>>
>> 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
>
>
More information about the R-help
mailing list