Learn R Programming

psycho (version 0.4.91)

refdata: Create a reference grid.

Description

Create a reference grid.

Usage

refdata(df, target = "all", length.out = 10, factors = "reference",
  numerics = "mean", na.rm = TRUE)

Arguments

df

The dataframe.

target

String or list of strings to indicate target columns. Can be "all".

length.out

Length of numeric target variables.

factors

Type of summary for factors. Can be "combination" or "reference".

numerics

Type of summary for numerics Can be "combination", any function ("mean", "median", ...) or a value.

na.rm

Remove NaNs.

Examples

Run this code
# NOT RUN {
library(psycho)

df <- psycho::affective
newdata <- refdata(df, target = "Sex")
newdata <- refdata(df, target = "Sex", factors = "combinations")
newdata <- refdata(df, target = c("Sex", "Salary", "Tolerating"), length.out = 3)
newdata <- refdata(df, target = c("Sex", "Salary", "Tolerating"), numerics = 0)
# }

Run the code above in your browser using DataLab