[R] binding all elements of list (character vectors) to a matrixasrows

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Tue Oct 11 10:09:05 CEST 2011


Marion,

try

rbind( Mymatrix, do.call( "rbind", Z))

Hth  --  Gerrit


On Tue, 11 Oct 2011, Marion Wenty wrote:

> dear r-users,
>
> i have got a problem which i am trying to solve:
>
> i have got the following commands:
>
> Mymatrix <- matrix(1:9,ncol=3)
> Z <-
> list("V1"=c("a","",""),"V2"=c("b","",""),"V3"=c("c","",""),"V4"=c("d","",""))
> Mymatrix <- rbind(Mymatrix,Z[[1]],Z[[2]],Z[[3]],Z[[4]])
>
> now this is working, but i would like to substitute
>
> Z[[1]],Z[[2]],Z[[3]],Z[[4]]
>
> for a command with which i could also use another list with a different
> number of elements, e.g. 5 or 6 elements.
>
> does anyone know the solution to this problem?
> thank you very much in advance!
>
> marion
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list