factor_to_numeric: Change the type of the column of a dataframe from factor to...

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

Change the type of the column of a dataframe from factor to numeric

Usage

1
factor_to_numeric(df, factor_name)

Arguments

df

Dataframe.

factor_name

Vector of names of factors to change to numeric.

Value

Same dataframe with type of the given columns changed to numeric.

Examples

1
2
3
df <- data.frame(A = rep(1:5, each = 10))
df$A <- factor(df$A)
df <- factor_to_numeric(df, "A")

HuraultMisc documentation built on Sept. 6, 2021, 9:09 a.m.