Search code examples
rsummarytools

How do I remove the header in RMarkdown for descr()?


I am trying to create a basic descriptive summary table in my RMarkdown pdf document.

data(iris)
library(summarytools)

iris %>%
  group_by(Species) %>%
  descr(Sepal.Length, stats = "fivenum", headings = FALSE)

I get the following output:

Descriptive Statistics  
Sepal.Length by Species  
Data Frame: iris  
N: 50  

               setosa   versicolor   virginica
------------ -------- ------------ -----------
         Min     4.30         4.90        4.90
          Q1     4.80         5.60        6.20
      Median     5.00         5.90        6.50
          Q3     5.20         6.30        6.90
         Max     5.80         7.00        7.90

How do I get rid of this part from the final output?:

Descriptive Statistics  
Sepal.Length by Species  
Data Frame: iris  
N: 50

I assumed headings = FALSE was going to do it, but I guess I was wrong! Any help would be much appreciated.


Solution

  • Should be fixed soon, but in the meantime, this will work:

    iris %>%
      group_by(Species) %>%
      descr(Sepal.Length, stats = "fivenum") %>% 
      print(headings = FALSE)
    
    ##                setosa   versicolor   virginica
    ## ------------ -------- ------------ -----------
    ##          Min     4.30         4.90        4.90
    ##           Q1     4.80         5.60        6.20
    ##       Median     5.00         5.90        6.50
    ##           Q3     5.20         6.30        6.90
    ##          Max     5.80         7.00        7.90