You can check to see if a variable is recognized as a factor using is.factor().
For example:
library(dplyr)
data(starwars)
is.factor(starwars$hair_color) # returns TRUE or FALSE
An alternative is to check the data types using the RStudio Environment tab, click on the small blue circle with white arrow to the left of the object and it will unfold the details of the data frame. In the case of this reprex data, the starwars$hair_color variable is not a factor, it is a character (chr). You can change it to a factor using starwars$hair_color <- as.factor(starwars$hair_color).
I hope this is helpful.