[R] turning list-elements into a vector

Liaw, Andy andy_liaw at merck.com
Wed Jul 16 16:59:31 CEST 2003


Something like this?

  myvec <- sapply(list.of.mat, function(x) x[i, j])

If all the matrices are of the same dimension, it might be easier to make
them into an array, and just "slice" through the array.

Andy



> -----Original Message-----
> From: Michael Kirschbaum [mailto:emkiba at gmx.de] 
> Sent: Wednesday, July 16, 2003 10:24 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] turning list-elements into a vector
> 
> 
> Hi.
> Can anyone help me?
> I want to create a vector from specific matrix-elements( 
> e.g.[1,1]) these matrices are elements of a list. Is there 
> any possibility to work without a loop? (e.g. with "lapply"?) 
> hope, you can help me thank you Michael
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, ...{{dropped}}




More information about the R-help mailing list