Re: [R] Table into a list

2012-03-06 Thread Thomas Coquet
Hello, Thanks to all for your answers. The solution given by R. Michael was perfect ! Thank you very much, that helped a lot ! Thomas On Tue, Feb 28, 2012 at 11:50 AM, Alemtsehai Abate abatea...@gmail.comwrote: Perhaps, the following does it as well. (d - data.frame(x1=letters[2*1:4 - 1],

Re: [R] Table into a list

2012-02-28 Thread Alemtsehai Abate
Perhaps, the following does it as well. (d - data.frame(x1=letters[2*1:4 - 1], x2=letters[2*1:4])) c(t(d)) Alemtsehai 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.

[R] Table into a list

2012-02-24 Thread thomas88
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

Re: [R] Table into a list

2012-02-24 Thread Rui Barradas
Hello, Try (d - data.frame(x1=letters[2*1:4 - 1], x2=letters[2*1:4])) c(apply(d, 1, identity)) Note that you'll need the concatenation 'c()'. Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Table-into-a-list-tp4418804p4419091.html Sent from the

Re: [R] Table into a list

2012-02-24 Thread Jorge I Velez
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

Re: [R] Table into a list

2012-02-24 Thread R. Michael Weylandt
Your question is not well formed: do you want a list or a string (totally different things)? Or even more likely, a character vector? What do you have now: is it really an array (=matrix) or is it the data.frame it looks like? If it's a matrix: x - matrix(letters[1:8], ncol = 2) x - as.vector(x)

Re: [R] Table into a list

2012-02-24 Thread R. Michael Weylandt
My apologies: I missed the order of the desired output: the easiest thing to do is likely to use the same techniques given below (and by others in this thread) with a transpose t() before. Michael On Sat, Feb 25, 2012 at 2:05 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Your

Re: [R] Table into a list

2012-02-24 Thread Jorge I Velez
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 =