Skip to content

Create function to add an empty row #35

@mbcann01

Description

@mbcann01

Often, when I am building tables for reports, I want there to be an empty row in between variables. Currently, I can manually add an empty row with dplyr::add_row(). Here is an example from the Sun Study report:

# Add a blank line in between each classroom
table_ss_application <- table_ss_application %>% 
  add_row(Classroom = "", `Sunscreen Application Outcome` = "", 
          Baseline = "", Intervention = "",
          Randomization = "", Maintenance = "", .after = 5
  ) %>% 
  add_row(Classroom = "", `Sunscreen Application Outcome` = "", 
          Baseline = "", Intervention = "",
          Randomization = "", Maintenance = "", .after = 11
  ) %>% 
  add_row(Classroom = "", `Sunscreen Application Outcome` = "", 
          Baseline = "", Intervention = "",
          Randomization = "", Maintenance = "", .after = 17
  )

However, that is long and clunky, and you have to list every variable by name. I want to come up with something more generic I can use to quickly add empty rows.

Would be even better if it were possible to do this directly in flextable rather than in data frames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Develop Next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions