Skip to contents

To make a table, you can use the cardea_table() function. This function takes three arguments:

  1. df: the data (which is usually piped into the function as seen below).
  2. header_color: The color of the header row (Cardea teal by default).
  3. table_name: The table will be saved as an image and as a Word document in the tables folder (which will be created if it doesn’t exist) using the name you select.
penguins %>% 
  cardea_table(table_name = "Sample table")
#>  Table image saved to tables/sample-table.png and table Word document
#> saved to tables/sample-table.docx

You can change the color of the header with the header_color argument.

penguins %>% 
  cardea_table(header_color = cardea_colors("Light Grey #2"),
               table_name = "Sample table v2")
#>  Table image saved to tables/sample-table-v2.png and table Word
#> document saved to tables/sample-table-v2.docx

The table will be created based on whatever data you pipe into the cardea_table() function. So, for example, if you wanted to only include certain variables, you could do as follows:

penguins %>% 
  slice(1:3) %>% 
  select(bill_depth_mm, bill_length_mm) %>% 
  cardea_table(header_color = cardea_colors("Light Grey #2"),
               table_name = "Sample table v3")
#>  Table image saved to tables/sample-table-v3.png and table Word
#> document saved to tables/sample-table-v3.docx