generate_data: Generate data

Description Usage Arguments Details Value Examples

Description

Generates a data.frame that can then be passed to a model to predict the effects of particular variables with the other variables held constant.

Usage

1
generate_data(data, range = NULL, length_out = 30)

Arguments

data

data.frame of variables from which the data.frame will be generated

range

character vector of the variables in data to represent by a sequence of values or NULL (the default)

length_out

integer scalar of the maximum number of values in a sequence

Details

Unless a variable is named in range it is fixed at its base value. A continuous variable's base value is its mean value of the same class, i.e., an integer variable's base value is its rounded mean. A logical variable's base value is FALSE while a factor's is its first level.

Alternatively if a variable is named in range then a sorted sequence of unique values of the same class from the minimum to the maximum of the observed values with a length of up to length_out (by default 30) is generated. If length_out is less than the number of possible values then in the case of a continous variable the values are as evenly distributed as possible while in the case of a factor only the first length_out levels are selected.

Value

The generated data.frame which can then be passed to a model for the purpose of estimating the effects of particular variables.

Examples

1
2
3
4
5
6
7
8
data <- data.frame(numeric = 1:10 + 0.1, integer = 1:10, 
   factor = factor(1:10), date = as.Date("2000-01-01") + 1:10,
   posixt = ISOdate(2000,1,1) + 1:10)
   
generate_data (data)
generate_data (data, range = "numeric")
generate_data (data, range = c("date", "factor"))
generate_data (data, range = c("numeric"))

poissonconsulting/datalist documentation built on Feb. 18, 2021, 10:24 p.m.