The as.numeric() function will convert a factor or character value into a numeric value. For instance, if you need to change a factor such as `Gender` 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 `Gender` as a numeric variable and saves it as a new column called `Gen_num`
Fingers$Gen_num <- as.numeric(Fingers$Gender)
# check the data frame
head(select(Fingers, Gender, Gen_num))
Example output: