You can change data types using as.* where * is the datatype to change to, the other way is using class().
class(df$var) = "Numeric".
The above method works only for a few combinations.
Become a proficient Data Analyst with our comprehensive Data Analyst Course.