randomMatrix | R Documentation |
Create a matrix of given dimension and fill it with random integer values
randomMatrix(dim = c(sample(10, 1), sample(10, 1)), values = seq_len(100))
dim |
integer vector of length two containing the number of rows and columns, respectively, that the output matrix shall contain |
values |
set of values to be used within the matrix |
# By default, the matrix has a random number of rows between 1 and 10 and
# a random number of columns between 1 and 10 and random values of 1:100
randomMatrix()
# You may specify the dimensions (here: 5 rows, 3 columns)...
randomMatrix(dim = c(5, 3))
# ... and the set of values to be used within the matrix
randomMatrix(dim = c(5, 3), values = c(0, 0.5, 1, NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.