r_matrix {rando}R Documentation

Generate a random Matrix

Description

Generate a random matrix, given a rando function and it's dimensions. By default, this will generate a square matrix.

Usage

r_matrix(
  engine,
  row_names = NULL,
  col_names = NULL,
  ...,
  nrow = default_n(row_names),
  ncol = default_n(col_names),
  .seed = NULL
)

Arguments

engine

The rando function that will be used to generate the random numbers

col_names, row_names

names to be assigned to the rows or columns. This is also used in deciding the dimensions of the result.

...

Unused

nrow, ncol

dimensions of the matrix. The default_n() function will provide a default value within context.

.seed

One of the following:

  • NULL (default) will not change the current seed. This is the usual case for generating random numbers.

  • A numeric value. This will be used to set the seed before generating the random numbers. This seed will be stored with the results.

  • TRUE. A random seed value will be generated and set as the seed before the results are generated. Again, this will be stored with the results.

To extract the random seed from a previously generated set of values, use pull_seed()

Value

A matrix with nrow rows and ncol columns an a type as decided by the function passed to engine.

Examples

set_n(5)

r_matrix(r_norm)


r_matrix(r_unif,min=1,max=2)


r_matrix(r_norm,mean=10,sd=2,ncol=2)



[Package rando version 0.2.0 Index]