Which function is used to check if a variable is a factor in R?

Which function is used to check if a variable is a factor in R?

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

Answer:

a) is.factor()

Explanation:

The is.factor() function checks if a variable is of type factor, which is used to handle categorical data in R.

Leave a Comment

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

Scroll to Top