Change the strings in a rezrDF
to factors
stringToFactor.Rd
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.
Examples
sbc007$treeEntryDF = sbc007$treeLinkDF %>% rez_mutate(Relation = stringToFactor(case_when(Relation == "Subj" ~ "Subj", T ~ "NonSubj")))