[Rd] String to list and visa versa

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Nov 14 18:32:24 CET 2006


"Tom McCallum" <tom.mccallum at levelelimited.com> writes:

> Hi,
> 
> I need to collapse a list into a string and then reparse it back into the  
> list.  Normally when I need to do this I simply use write.csv and  
> read.csv, but I need to do this in memory within R rather than writing out  
> to file.  

> Are there any bespoke commands that any knows of that does  
> something like this or any tips for doing this that anyone can
> suggest?

Er, perhaps you should send that sentence off to Iain McC.[*], so that
we can find out what killed it. ;-)

>  I  
> basically don't care upon the string representation, only that I can  
> manipulate the list as a string and then reparse it back to a valid list  
> object.

You might want to investigate deparse() and parse().

[*] http://www.johnhannah.net/mccallum.html

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list