[Solved] Creating a matrix with random generated variables in R [closed]

[ad_1]

Is this what you want?

mat <- as.matrix(data.frame(V1 = sample(1:2,   100, replace = TRUE),
                 V2 = sample(1:5,   100, replace = TRUE),
                 V3 = sample(10:50, 100, replace = TRUE),
                 V4 = sample(1:3,   100, replace = TRUE),
                 V5 = sample(1:5,   100, replace = TRUE)))

1

[ad_2]

solved Creating a matrix with random generated variables in R [closed]