the title of this thread was wrong. it's misleading sorry.
ishida
2013/3/11 ishi soichi soichi...@gmail.com
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
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.list
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) x[i,])
yes. thank you.
ishida
2013/3/11 Jorge I Velez jorgeivanve...@gmail.com
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,
You could also do:
simplify2array(x.list)[2,]
#[1] 0.1 3.0
A.K.
- Original Message -
From: Jorge I Velez jorgeivanve...@gmail.com
To: ishi soichi soichi...@gmail.com
Cc: r-help r-help@r-project.org
Sent: Monday, March 11, 2013 6:57 AM
Subject: Re: [R] take two columns from a set
5 matches
Mail list logo