title: Use tbl_summary to get the means of categorical data
body: <p>I would like to produce the both the means and the frequencies for a subset of my categorical variables.</p>
  <pre><code>mtcars2 &lt;- mtcars %&gt;% mutate(across(matches('cyl|gear|carb'), as.factor))
  </code></pre>
  <p>I know that I can use this to get a output for my categorical and my continuous separately.</p>
  <pre><code>mtcars_out &lt;- tbl_summary(mtcars2, 
                            statistic = list(all_numeric() ~ &quot;{mean} ({sd})&quot;,
                                             all_categorical() ~ &quot;{n} / {N} ({p}%)&quot;)) %&gt;% as_tibble()
  </code></pre>
  <p>Since mtacrs$cyl already has &quot;level&quot; associated with it, I want to use mtcars2 as it is and generate the mean for that variable. Something like this... but tbl_summary does not like this, since it is a categorical variable.</p>
  <pre><code>mtcars_out &lt;- tbl_summary(mtcars2, 
                            statistic = list(all_numeric() ~ &quot;{mean} ({sd})&quot;,
                                             &quot;cyl&quot;~&quot;{mean} ({sd})&quot;)) %&gt;% as_tibble()
  
  Error: Problem with `mutate()` input `tbl_stats`.
  x There was an error assembling the summary statistics for 'cyl'
    with summary type 'categorical'.
  
  There are 2 common sources for this error.
  1. You have requested summary statistics meant for continuous
     variables for a variable being as summarized as categorical.
     To change the summary type to continuous, add the argument
    `type = list(cyl ~ 'continuous')`
  2. One of the functions or statistics from the `statistic=` argument is not valid.
  i Input `tbl_stats` is `pmap(...)`.
  </code></pre>
  <p>I tried specifying the type within the call, but that doesn't work either.</p>
  <pre><code>mtcars_out &lt;- tbl_summary(mtcars2, 
                            type = list(&quot;cyl&quot;~&quot;continuous&quot;),
                            statistic = list(all_numeric() ~ &quot;{mean} ({sd})&quot;,
                                             all_categorical() ~ &quot;{n} / {N} ({p}%)&quot;)) %&gt;% as_tibble()
  
  
  
   Error: Problem with `mutate()` input `summary_type`.
  x Column 'cyl' is class &quot;factor&quot; and cannot be summarized as a continuous variable.
  i Input `summary_type` is `assign_summary_type(...)`.
  </code></pre>
  <p>My actual dataset has 500 variables, and have already specified the class for each variable so I don't want to have to change the class type of my original data set. I want to specify it within the tbl_summary call.</p>
  <p>Any help is greatly appreciated!!</p>