Learn R Programming

ibmcraftr (version 1.0.0)

syn_pop: Create a synthetic population having several states.

Description

Populate a matrix in which columns represent the states of the individuals and rows represent the individuals.

Usage

syn_pop(states, shuffle = FALSE)

Arguments

states
A numeric vector with each element representing the number of individuals in a particular state its index corresponds to.
shuffle
A logical value to enable shuffling of the individuals (rows) in the resulting matrix.

Value

A matrix of 0s, and 1s. The rows representing the individuals and the columns representing the states the individuals are in

Examples

Run this code
syn_pop(c(3,2,1))
syn_pop(c(0,0,1,5), shuffle=TRUE)

Run the code above in your browser using DataLab