How do you convert a factor to a numeric data type in R?

How do you convert a factor to a numeric data type in R?

a) as.factor()
b) as.numeric()
c) as.character()
d) as.logical()

Answer:

b) as.numeric()

Explanation:

The as.numeric() function is used to convert factors to numeric data types in R.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top