I have a data frame named "insurance" with both numerical and factor variables. How can I select all factor variables so that I can check the levels of the categorical variables?
I tried sapply(insurance,class) to get the the classes of all variables. But then I can't make logical argument based on if class(var)="factor" as the variable names are also included in the result of sapply().
Thanks,