You could also do:
simplify2array(x.list)[2,]
#[1] 0.1 3.0
A.K.
- Original Message -
From: Jorge I Velez
To: ishi soichi
Cc: r-help
Sent: Monday, March 11, 2013 6:57 AM
Subject: Re: [R] take two columns from a set of lists
Is the following that you are looking for?
unlist(lapply
yes. thank you.
ishida
2013/3/11 Jorge I Velez
> Is the following that you are looking for?
>
> unlist(lapply(x.list, "[", 2))
>
> HTH,
> Jorge.-
>
>
> On Mon, Mar 11, 2013 at 9:52 PM, ishi soichi <> wrote:
>
>> say I have a matrix and lists like
>>
>> x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.
Is the following that you are looking for?
unlist(lapply(x.list, "[", 2))
HTH,
Jorge.-
On Mon, Mar 11, 2013 at 9:52 PM, ishi soichi <> wrote:
> say I have a matrix and lists like
>
> x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2)
>
> x.list <- lapply(seq_len(nrow(x)), function(i
say I have a matrix and lists like
x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2)
x.list <- lapply(seq_len(nrow(x)), function(i) x[i,])
if I want a column of the matrix x, I write
x[, 2]
for example.
But how can I do something similar for a set of lists, x.list, above?
> x.lis
the title of this thread was wrong. it's misleading sorry.
ishida
2013/3/11 ishi soichi
>
> say I have a matrix and lists like
>
> x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2)
>
> x.list <- lapply(seq_len(nrow(x)), function(i) x[i,])
>
> if I want a column of the matrix x, I w
5 matches
Mail list logo