rollmatch (version 1.0.0)

chr_2_factor: Convert character variables in formula to factor variables. As it's an internal helper function to aid in testing, it is not exported for use outside of the package.

Description

Convert character variables in formula to factor variables. As it's an internal helper function to aid in testing, it is not exported for use outside of the package.

Usage

chr_2_factor(df, vars)

Arguments

df

A dataframe.

vars

A vector of dataframe column names

Value

Dataframe where all character variables are now factors

Examples

Run this code
# NOT RUN {
df <- data.frame(x = 1:3, y = 3:1, z = c("a", "b", "c"),
                 stringsAsFactors = FALSE)
vars <- names(df)
newdf <- df <- chr_2_factor(df, vars)
lapply(df, class)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab