[R] Problems with rbind
Jonathan Rougier
J.C.Rougier at durham.ac.uk
Tue Sep 10 14:53:50 CEST 2002
Bayesianbay at aol.com wrote:
>
> Dear list
>
> I have a simple question that I have a mental block on:
>
> Having used a loop (from i = 1 to n) to assign some numerical values to
> row.list[[i]]
> e.g. row.list[[3]]= 0 1
> I am wanting to combine the output into a simple matrix.
>
> for example, if I combine the output from persons 1 to 3 into a matrix, I
> thought I could do :
> h<-rbind(row.list[[1]]:row.list[[3]])
>
> However, I get the errors:
> 1: Numerical expression has 2 elements: only the first used in:
> row.list[[1]]:row.list[[3]]
>
> Yet if I did this by using h<
> -rbind(row.list[[1]],row.list[[2]],row.list[[3]]), this would work.
>
> Could anybody explain how I can combine large values of the vectors (i.e. by
> using :) without resorting to having to write out each one in the command?
I think you may want
do.call("rbind", row.list)
Cheers, Jonathan.
--
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list