I am trying to create a matrix of 35 rows and 15 columns with numbers from 1 to 4 sampled randomly.
Can you please help me create it just using the matrix and sample functions? I am a noob. Not sure if cbind
can be used here.
This is where I am:
m1 <- matrix(data = 1:525, nrow = 35 ,ncol = 15)
sample (m1, 1:4, replace = TRUE)
I couldn't find what I needed in the R ?help section.
Aucun commentaire:
Enregistrer un commentaire