


As I have spent countless hours devising scripts to create a similar table, to see it done so quickly really feels like an advancement of our current tools. I am extremely impressed with the final output- my hats off to Daniel Sjoberg and his team. Hover over the number of files and click the plus button. ) %>% save_as_docx(path="srcchirp_table1_demographics.docx") open the current directory in the most recently used code window code -r. Though there is probably a way to style that caption, I am ok doing the final edits in Word (as I will assign them a style).įinally, let’s export our table to Word using the flextable pipe function save_as_docx and look at our final results: ft.demographics %>% The caption in flextable is a strange entity and doesn’t easily play along with the other formatting options used with rows and tables. The way to read this flextable code is as follows:Ĭhange the style of rows ( i) 1 through 2 1:2 of the header by formatting the text ( pr_t) as bold.
R markdown plus minus how to#
Title: bold is replaced with markdown ‘**’įlextable is easy to work with and so I will refer to the documentation ( ) on how to apply bold to the headings.Column and Row Organization: No difference.Let’s look at the differences in betwen the table: In this example, ‘ft’ refers to flextable. I often prefix my variables by the object they contain.

Label = c(sex ~ "Sex", visitage = "Age (years)")) %>%
