A factor in R is used to categorize a given data. The length of a factor in R is the number of items present in the factor.
To obtain the length or number of items present in a factor, we use the
length() function takes the factor object as its single parameter value.
length() function returns the length of a given factor.
# creating a factor object Height <- factor(c("Tall", "Average", "Short", "Tall")) # implementing the length() function length(Height)
View all Courses