Imagine you need to convert a character data type to a numeric data type for a large dataset. How would you approach this task in R?

  • Use as.numeric() function
  • Use mutate() function from dplyr
  • Use rapply() function
  • Use type.convert() function
We would use as.numeric() function to convert character data type to numeric. However, it's important to ensure that the character data is indeed convertible to numeric, otherwise NA's might be introduced.
Add your answer
Loading...

Leave a comment

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