stringToFactor: Change the strings in a 'rezrDF' to factors

View source: R/rezrDF.R

stringToFactorR Documentation

Change the strings in a rezrDF to factors

Description

Change the strings in a rezrDF to factors

Usage

stringToFactor(df, colsToChange = NULL, levels = list())

Arguments

df

The data.frame to be modified.

colsToChange

The columns to be modified. If left blank, all character columns will be factor-fied.

levels

Factor levels, as a list with each label being a column name.

Value

The column in factor format.

Examples

sbc007$treeEntryDF = sbc007$treeLinkDF %>% rez_mutate(Relation = stringToFactor(case_when(Relation == "Subj" ~ "Subj", T ~ "NonSubj")))

johnwdubois/rezonateR documentation built on Nov. 19, 2024, 11:17 p.m.