title: How to check if a variable is categorical with R?
body: <p>I have an <strong>R</strong> data frame and some of the variables are categorical. For example sex is "male" or "female" and "do you smoke" is 0 or 1. Others  variables instead are continuous. 
  I would like to know if there is any way to decide if a variable is categorical or not and in case compute its frequencies. </p>
  
  <p>I think in my case a good test would be to check if the variable takes less than k=4 values.</p>