title: Creating a Label column for character variables
body: <p>Suppose I have this example dataset with only character variables.</p>
  <pre><code>dxe1&lt;-c(&quot;W07XXXA&quot;, &quot;NULL&quot;, &quot;3&quot;)
  dxe1_poa&lt;-c(&quot;Y&quot;,&quot;NULL&quot;,&quot;N&quot;)
  dxe2&lt;-c(&quot;NULL&quot;,&quot;NULL&quot;,&quot;NULL&quot;)
  dxe2_poa&lt;-c(&quot;NULL&quot;,&quot;NULL&quot;,&quot;NULL&quot;)
  df3 &lt;- data.frame(dxe1,dxe1_poa, dxe2,dxe2_poa)
  </code></pre>
  <p>I want to label the variables and so I created a label vector for them:</p>
  <pre><code>var.labels = c(dxe1=&quot;External Cause of Injury Diagnosis 1&quot;,
                 dxe1_poa=&quot;External Cause of Injury Diagnosis 1 - Present on Admission&quot;, dxe2=&quot;External Cause of Injury Diagnosis 2&quot;, dxe2_poa=&quot;External Cause of Injury Diagnosis 2 - Present on Admission&quot;)
  
  label(df3) = as.list(var.labels[match(names(df3), names(var.labels))])
  
  label(df3)
  </code></pre>
  <p>My goal is to create a table similar to the one below, that is, I want to have a label column that gives the variable description. I only want the missing observations to display as the statistics and not min, max, mean, sd. They should be just n.a. like in the table below.</p>
  <p><a href="https://i.stack.imgur.com/UYIVn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UYIVn.png" alt="enter image description here" /></a></p>
  <p>I am trying with the following set of codes:</p>
  <pre><code>df3 &lt;- Filter(is.character, df3)
  Variables &lt;- names(df3)
  Label &lt;- label(df3)
  Missing &lt;- sapply(df3, function(x) sum(is.na(x)))
  Type &lt;- sapply(df3, function(x) {tmp &lt;- class(x);if(length(x) &gt; 1) tmp[2] else tmp[1]})
  Min &lt;- sapply(df3, function(x) min(x, na.rm = TRUE))
  Max &lt;- sapply(df3, function(x) max(x, na.rm = TRUE))
  SD &lt;- sapply(df3, function(x) format(round(sd(x, na.rm=TRUE), 2), nsmall = 2))
  Mean &lt;- sapply(df3, function(x) format(round(mean(x, na.rm=TRUE), 2), nsmall = 2))
  #To get the Latex table for the rows 
  knitr::kable(data.frame(Variables, Label, Missing, Type, Min, Max, Mean, SD, row.names = NULL), &quot;latex&quot;)
  </code></pre>
  <p>However, with the above set of codes, the statistics of mean and SD are still displayed. I want to make them appear as &quot;n.a&quot; like the table above. Any suggestions? Also, I have minimum and maximum appearing in the character form. I just want the number forms to appear.</p>