simsam: Simulate Randomly Generated Correlated Data

Description Usage Arguments Value Examples

Description

Simulate n rows of a randomly generated data set from an existing data set. General structure (column means and correlations) are preserved.

Usage

1
simsam(orig_dat, nrows, your_choice_of_NA = NULL)

Arguments

orig_dat

A data set the user wishes to generate a random, correlated data set for.

nrows

The number of rows to make the output data set.

your_choice_of_NA

A vector of characters that denote missing values (e.g., "N/A", 999).

Value

Returns a data set of randomly generated data corelated with the riginal data set.

Examples

1
2
3
4
library(dplyr)
(sim_dat <- simsam(mtcars, 1000)[[1]] %>% tbl_df())
colMeans(sim_dat); colMeans(mtcars)
cor(sim_dat); cor(mtcars)

steventsimpson/simsam documentation built on May 30, 2019, 5:36 p.m.