rmat: Simple matrix wrapper for gnerating random numbers.

Description Usage Arguments Value See Also Examples

Description

A shortcut for creating a matrix with randomly drawn numbers from arbitrary distribution available in R.

Usage

1

Arguments

distribution

A distribution available in R that should generate the numbers for filling out the matrix, e.g. rnorm or coderunif.

nrow

A scalar indicating the desired number of rows.

ncol

A scalar indicating the desired number of columns.

byrow

A logical value, if TRUE (the default) the matrix is filled by rows, otherwise the matrix is filled by columns.

...

Additional arguments to be passed to or from methods.

Value

A matrix with nrow rows and ncol columns, filled with numbers generated from distribution.

See Also

matrix, rnorm, runif etc.

Examples

1
2
3
4
5
# create a 2 by 2 matrix with numbers randomly drawn from uniform distribution
rmat(runif, 2, 2)

# same, but now we pass on additional arguments to runif 
rmat(runif, 2, 2, min=10, max=20)

hstojic/hfunk documentation built on May 17, 2019, 6:16 p.m.