From vdergachev at rcgardis.com  Tue Nov 14 18:09:22 2006
From: vdergachev at rcgardis.com (Vladimir Dergachev)
Date: Tue, 14 Nov 2006 12:09:22 -0500
Subject: [Rd] String to list and visa versa
In-Reply-To: <op.ti0mvjx2ffxks9@norisk>
References: <op.ti0mvjx2ffxks9@norisk>
Message-ID: <200611141209.22173.vdergachev@rcgardis.com>

On Tuesday 14 November 2006 12:00 pm, Tom McCallum wrote:
> 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?  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.

#List -> string:

#
# Put whatever you want into collapse to separate list entries
#
paste(unlist(L), collapse=",")

#String->list
strsplit(S, ",")

                best

                   Vladimir Dergachev


>
> Many thanks for your help,
>
> Tom



[Rd] String to list and visa versa
Vladimir Dergachev