The as.numeric() function will convert a factorial value into a numeric value. For instance, if you need to change a factor such as `Sex` into numeric values, the as.numeric() function will assign each group a number and convert it from being coded as a categorical variable to being a quantitative variable. (See factor() for converting quantitative variables into categorical variables).
Example:
# designates `Sex` as a numeric variable and saves it as a new column called `Sex_num`
Fingers$Sex_num <- as.numeric(Fingers$Sex)
# check the data frame
head(select(Fingers, Sex, Sex_num))
Example output: