createData: Create toy data

Description Usage Arguments Value Note Examples

View source: R/createData.R

Description

Creates a named matrix of toy data from an m-dimensional zero-mean normal distribution with identity covariance matrix. For convenience in various examples and tests.

Usage

1
createData(n, m, n.na = 0)

Arguments

n

A non-negative integer giving the number of observations/samples.

m

A non-negative integer giving the number of variables/features.

n.na

An integer from 0 to n*m giving the number of NAs in the output. Default is 0.

Value

An n times m numeric matrix of observations from zero-mean Gaussian random variables.

Note

The n.na NAs are randomly inserted in the output.

Examples

1
2
3
4
5
6
createData(10, 4)
createData(1, 2)

# Also works for the degenerate cases!
createData(3, 0)
createData(0, 3)

AEBilgrau/correlateR documentation built on Nov. 15, 2019, 9:21 a.m.