[R] How use a matrix method?

Peter Dalgaard
Sun, 19 Apr 2009 08:32:24 -0000

Grze? wrote:
> Why when I want to find my value from matrix I get: 2,3,4,1,2? I think that
I
> should get: 1,2,3,4,7,8.
>
>> macierz=matrix(1:4,7,8)

That's

matrix(data=1:4, nrow=7, ncol=8)

a 7x8 matrix with the numbers 1 to 4 repeated columnwise.

You probably want something like matrix(c(1:4, 7, 8))

--
    O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907