x <- matrix(sample(0:1, 1200, replace=T, prob=c(0.952, 0.048)), ncol=30)
table(x)
x
01
1131 69
x <- matrix(sample(0:1, 1200, replace=T, prob=c(0.952, 0.048)), ncol=30)
table(x)
x
01
1151 49
bikemike42 wrote:
Dear All,
I am trying to create an artificial binary matrix
Thanks a lot Erik and Tony!
Both of your suggestions accomplish what I need.
Cheers,
Mike
Erik Iverson wrote:
Try
matrix(rbinom(100, 1, prob = 0.048), nrow = 10)
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of bikemike42
Try
matrix(rbinom(100, 1, prob = 0.048), nrow = 10)
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of bikemike42
> Sent: Tuesday, November 03, 2009 11:49 AM
> To: r-help@r-project.org
> Subject: [R] Create Artificial Binary Ma
3 matches
Mail list logo