My apologies.  The last line should have been

with(d, sort(c(as.character(x1), as.character(x2))))

Regards,
Jorge.-


On Sat, Feb 25, 2012 at 2:03 AM, Jorge I Velez <> wrote:

> Perhaps the following?
>
> d <- structure(list(x1 = structure(1:4, .Label = c("a", "c", "e",
> "g"), class = "factor"), x2 = structure(1:4, .Label = c("b",
> "d", "f", "h"), class = "factor")), .Names = c("x1", "x2"), class =
> "data.frame", row.names = c("1",
> "2", "3", "4"))
>
> with(d, c(as.character(x1), as.character(x2)))
> #  [1] "a" "c" "e" "g" "b" "d" "f" "h"
>
> HTH,
> Jorge.-
>
>
> On Fri, Feb 24, 2012 at 5:32 PM, thomas88 <> wrote:
>
>> Hello,
>> I am looking for a way to transform an array into a list (or a string).
>> My array has two columns 1 and 2, and I would like to create a list of the
>> values.
>>
>> Let's say I have :
>>
>>       x1       x2
>> 1      a          b
>> 2      c          d
>> 3      e          f
>> 4      g          h
>>
>> What I would like to obtain is a,b,c,d,e,f,g,h.
>>
>> I tried without success melt and reshape ( reshape(my_array,
>> direction="long", varying=1:2) ) but I cannot get it work.
>>
>> Thanks a lot !!!
>> thomas
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Table-into-a-list-tp4418804p4418804.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help@r-project.org 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.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to