edar_get_new_data: Get new data set

edar_get_new_dataR Documentation

Get new data set

Description

Create a new data set based on the provided data frame in which all covariates are kept fixed, except those specified by the user.

Usage

edar_get_new_data(data, n, x, cat.values = NULL)

Arguments

data

a data frame with the data. Observations must be the rows, variables in the columns.

n

integer, size of the new data set

x

string with the name of the numeric variable that will vary within the range of its values in the original data set. All other numeric covariates will be set to their average value

cat.values

named list of string vectors. The name of each element of the list (the string vectors) must match variable names in the data. The element of the string vectors must be strings with the name of the categories to use in the new data set. To generate the new data set, the numeric columns will be set to their mean value, except the column specified in the parameter x. The categorical values are set to their first category or the first category in alphabetic order. One can set the categorical variables to different values or use more than one category by setting this parameter cat.values as desired. For instance, suppose there is a categorical variable in the data set named education, taking the values of High or Low. If cat.values=NULL, the new data set returned will be fixed at education=High. One can use education="Low" by setting cat.value=list(eductation="low"). One can have both levels of education returned by setting cat.value=list(eductation=c("low", "high")). See more examples in the documentation below.


DiogoFerrari/edar documentation built on May 8, 2022, 8:26 a.m.