ys_factors_fl: Add factors based on flags

View source: R/flags.R

ys_factors_flR Documentation

Add factors based on flags

Description

The user passes a data set to modify, a yspec object, and the names of flags in the yspec object to create factors in the data set using ys_factors().

Usage

ys_factors_fl(data, spec, ...)

Arguments

data

the data set to modify.

spec

a yspec object.

...

tidy-select specification of flag names to select.

Details

Only eligible columns will be considered for factor creation (either a values field is present or the make_factor flag is set). Therefore, a flag containing a general list of data columns (potentially continuous and discrete) could be passed without generating an error.

See Also

ys_factors(), ys_add_factors()

Examples

data <- ys_help$data()
spec <- ys_help$spec()

names(ys_flags(spec))

data <- ys_factors_fl(data, spec, cat)

head(data, 2)

data <- ys_factors_fl(data, spec, covariate, nm)

head(data, 2)


metrumresearchgroup/yspec documentation built on March 4, 2025, 11:20 p.m.