random_matrix: Generate a random matrix

View source: R/random_matrix.R

random_matrixR Documentation

Generate a random matrix

Description

Generate a random matrix

Usage

random_matrix(n, p, values = -9:9)

Arguments

n

The number of rows

p

The number of columns

values

A range of values from which to sample with replacement to construct the random matrix

Value

A n by p matrix with random values sampled with replacement from values

Examples

library(dasc2594)

# simulate a random vector
u <- random_matrix(3, 1)

# simulate a random matrix
A <- random_matrix(3, 3)

# simulate a random matrix with only positive values
B <- random_matrix(3, 3, values = 1:9)


jtipton25/dasc2594 documentation built on Oct. 7, 2022, 3:46 p.m.