title: Convert numerical variable to categorical variable
body: <p>I have a list of columns that contain 0 and 1 as values. Right now they are treated as numerical variables but I want them to be treated as categorical.</p>
  <p>I tried</p>
  <pre><code>as.factor(df[,&quot;diseasesA&quot;:&quot;diseaseM&quot;], exclude = NULL)
  </code></pre>
  <p>but received the following error message:</p>
  <pre class="lang-r prettyprint-override"><code>Error in as.factor(df[,&quot;diseasesA&quot;:&quot;diseaseM&quot;],  : 
    unused argument (exclude = NULL)
  </code></pre>
  <p>not using <code>&quot;exclude = NULL&quot;</code> gave me the following error message:</p>
  <pre class="lang-r prettyprint-override"><code>Error in &quot;diseasesA&quot;:&quot;diseaseM&quot; : NA/NaN argument
  In addition: Warning messages:
  1: In eval(jsub, setattr(as.list(seq_along(x)), &quot;names&quot;, names_x),  :
    NAs introduced by coercion
  2: In eval(jsub, setattr(as.list(seq_along(x)), &quot;names&quot;, names_x),  :
    NAs introduced by coercion
  </code></pre>