This function will code a column containing categorical "string" values into numerical values

code_categorical(x, variable = "", order = c())

Arguments

x

dataframe

variable

column name

order

c() of column values in order

Examples

code_categorical(x, variable = "columnName", order = c("string1", "string2", "string3"))
#> Error in x[which(x[variable] == order[value]), variable] <- value: object 'x' not found