How to fill matrix with random numbers in R?

后端 未结 6 1486
自闭症患者
自闭症患者 2021-02-03 20:18
expand.grid(i=rexp(5,rate=0.1))

It creates just one col but is there some way to multiply this easily to 5 cols? I mean the matlab-way-of-doing-things

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 20:43

    you can do something like:

    matrix(rexp(200), 10)
    

    And of course use what ever distribution you want.

提交回复
热议问题