Suppose you're working with a large dataset and need to ensure all numeric columns are indeed of numeric data type. How would you approach this?

  • Both A and B are correct
  • Convert all columns to numeric using as.numeric()
  • Use is.numeric() function with lapply() to check all columns
  • Use str() function to check the structure of the data frame
To ensure that all numeric columns in a large dataset are indeed numeric, we can use the str() function to get an overview of the data frame structure. We can also use the is.numeric() function in conjunction with lapply() to check all columns.
Add your answer
Loading...

Leave a comment

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