.
maybe
sapply(lapply(your.list, coef), rbind)
can do it.
Regards
Petr
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of eliza botto
Sent: Wednesday, September 11, 2013 4:23 PM
To: r-help@r-project.org
Subject: [R] list
,] 0.01788307 -0.5624307
A.K.
- Original Message -
From: eliza botto eliza_bo...@hotmail.com
To: r-help@r-project.org r-help@r-project.org
Cc:
Sent: Wednesday, September 11, 2013 10:22 AM
Subject: [R] list to matrix
Dear useRs,
If i have a list of the following form and i want to convert
On Wed, Dec 5, 2012 at 12:02 AM, arun smartpink...@yahoo.com wrote:
Hi,
p - lapply(1:1e6, function(i)c(i, log2(i)))
system.time(z1 - t(sapply(p,function(x)x)))
# user system elapsed
# 2.568 0.048 2.619
system.time(z1 - do.call(rbind,p))
# user system elapsed
# 4.000
How do I convert a list to a matrix?
--8---cut here---start-8---
list(c(5, 101), c(1e+05, 46), c(15, 31), c(2e+05, 17),
c(25, 19), c(3e+05, 11), c(35, 12), c(4e+05, 25),
c(45, 19), c(5e+05, 16))
as.matrix(a)
[,1]
[1,]
Try:
matrix(unlist(a), ncol=2, byrow=T)
--Mark Lamias
From: Sam Steingold s...@gnu.org
To: r-help@r-project.org
Sent: Tuesday, December 4, 2012 3:09 PM
Subject: [R] list to matrix?
How do I convert a list to a matrix?
--8---cut here
On Tue, Dec 4, 2012 at 8:09 PM, Sam Steingold s...@gnu.org wrote:
How do I convert a list to a matrix?
--8---cut here---start-8---
list(c(5, 101), c(1e+05, 46), c(15, 31), c(2e+05, 17),
c(25, 19), c(3e+05, 11), c(35, 12), c(4e+05, 25),
-help@r-project.org
Cc:
Sent: Tuesday, December 4, 2012 3:09 PM
Subject: [R] list to matrix?
How do I convert a list to a matrix?
--8---cut here---start-8---
list(c(5, 101), c(1e+05, 46), c(15, 31), c(2e+05, 17),
c(25, 19), c(3e+05, 11), c(35
On Tue, Dec 4, 2012 at 8:17 PM, arun smartpink...@yahoo.com wrote:
Hi,
Try this:
list1-list(c(5, 101), c(1e+05, 46), c(15, 31), c(2e+05, 17),
c(25, 19), c(3e+05, 11), c(35, 12), c(4e+05, 25),
c(45, 19), c(5e+05, 16))
res-t(sapply(list1,function(x) x))
Bah
To: arun
Cc: R help; s...@gnu.org
Subject: Re: [R] list to matrix?
On Tue, Dec 4, 2012 at 8:17 PM, arun smartpink...@yahoo.com wrote:
Hi,
Try this:
list1-list(c(5, 101), c(1e+05, 46), c(15, 31), c(2e+05, 17),
c(25, 19), c(3e+05, 11), c(35, 12), c(4e+05, 25),
c
wdun...@tibco.com
To: R. Michael Weylandt michael.weyla...@gmail.com; arun
smartpink...@yahoo.com
Cc: R help r-help@r-project.org; s...@gnu.org s...@gnu.org
Sent: Tuesday, December 4, 2012 6:28 PM
Subject: RE: [R] list to matrix?
No need for all this (see solutions including mine already given
Hi everyone.
Is it possible in R to create a matrix or a list (vector) or R object. For
instance, I have
f1 - function(x) sqrt(x%*%x);
f2 - function(x) (2x+1);
I would like to do something like
L - List();
L[1] = f1;
L[2] = f2;
So, is there a way to create matrix or vector that can contains
You probably need to review the Intro to R to understand indexing:
f1 - function(x) sqrt(x%*%x);
f2 - function(x) (2*x+1);
L - list()
L[[1]] - f1
L[[2]] - f2
L # contains the objects
[[1]]
function (x)
sqrt(x %*% x)
[[2]]
function (x)
(2 * x + 1)
L[[1]](3) # now call the functions in
...@imail.org
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Filoche
Sent: Tuesday, October 12, 2010 9:17 AM
To: r-help@r-project.org
Subject: [R] List or matrix of object
Hi everyone.
Is it possible in R
On Oct 12, 2010, at 11:17 AM, Filoche wrote:
Hi everyone.
Is it possible in R to create a matrix or a list (vector) or R
object. For
instance, I have
f1 - function(x) sqrt(x%*%x);
f2 - function(x) (2x+1);
I would like to do something like
L - List();
L[1] = f1;
L[2] = f2;
You should
Hi again everyone.
I found I could use a list with
l = list()
l[[1]] = myObj
instead of
l[1] = myObj
Anyone can explain me why the use of double [] is required?
Regards,
Phil
--
View this message in context:
http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992121.html
-project.org
Subject: Re: [R] List or matrix of object
Hi again everyone.
I found I could use a list with
l = list()
l[[1]] = myObj
instead of
l[1] = myObj
Anyone can explain me why the use of double [] is required?
Regards,
Phil
--
View this message in context: http://r
Thank you everyone for your answers.
Regards,
Phil
--
View this message in context:
http://r.789695.n4.nabble.com/List-or-matrix-of-object-tp2992101p2992304.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
Dear list,
I have a list with 1000 x1000 lines and columns do you know how I can
convert it to matrrix or data.frame.
Thanks.
Juan
--
Juan Tomás Sayago
Universidad Central
http://sites.google.com/site/juantomassayago/
Objetivo: Garantizar a cada ser humano que habite en el país, una cantidad
On 12-Feb-10 13:14:29, Juan Tomas Sayago wrote:
Dear list,
I have a list with 1000 x1000 lines and columns do you know how I can
convert it to matrrix or data.frame.
Thanks.
Juan
as.data.frame() will convert it to a dataframe. If you then apply
as.matrix() to the result you will get a
Ted.Harding at manchester.ac.uk writes:
On 12-Feb-10 13:14:29, Juan Tomas Sayago wrote:
Dear list,
I have a list with 1000 x1000 lines and columns
Lists have neither lines nor columns. Can you explain exactly what you have?
E.g. show us the code that created your list?
do you know how
Another alternative:
do.call('cbind', l[!sapply(l, function(x)all(is.na(x)))])
On 11/2/07, Petr PIKAL [EMAIL PROTECTED] wrote:
Hi
[EMAIL PROTECTED] napsal dne 02.11.2007 12:00:09:
Thanks,
I have the case that there is a NA in the list. This should not be a
column.
But na.omit(l)
you can use do.call(), e.g.,
do.call(cbind, l)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web:
Hello,
I have a list of vectors (all the same length). How to convert the list
to a matrix? Each vector should be a column.
I tried this:
l - list(c(1,2,3),c(1,2,3),c(1,2,3))
mat - matrix( unlist(l), nrow=length(l) )
But I think this is not very efficient. Is there a better solution?
Thanks
23 matches
Mail list logo