How to Convert a Factor in R
> directions <- c("North", "East", "South", "South")
> directions.factor <- factor(directions)
> directions.factor
[1] North East South South
Levels: East North South
How to Convert a Factor in R
> directions <- c("North", "East", "South", "South")
> directions.factor <- factor(directions)
> directions.factor
[1] North East South South
Levels: East North South
factor in r
# This returns a character vector, the as.numeric() function
# is still required to convert the values to the proper type (numeric).
f <- levels(f)[f]
f <- as.numeric(f)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us