[R] Matrix output from drawing functions

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Jan 14 17:15:42 CET 2000


Kjetil Kjernsmo <kjetil.kjernsmo at astro.uio.no> writes:

> but I figured that if I go:
> > rpois(10,1:10)
> I would get a 10x10 matrix as output, with random values for each of
> the vector elements in the row vectors, but I'm getting 
>  [1]  3  4  3  4  6  9 10  6 11  9
> so, that is obviously not the case... :-) BTW, what am I getting...?

try plot(rpois(100,1:100)) and I think you'll see the light...

> So, is there a simple way of doing this...? If not, would it be reasonable
> for me to request this as a feature in future releases?

matrix(rpois(100,rep(1:10,10)),10,byrow=T) should do it. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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