write_simple_xlsx: Write an xlsx file with simple options for formatting

Description Usage Arguments Value Examples

View source: R/write_simple_xlsx.R

Description

A wrapper to openxlsx with options for basic formatting, including a frozen header pane, and optional alternating shading to distinguish groups of observations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
write_simple_xlsx(
  x,
  file = NULL,
  group,
  group_fill = "#ffcccb",
  date_format = "yyyy-mm-dd",
  first_active_row = 2L,
  zoom = 130L,
  overwrite = TRUE
)

Arguments

x

a data frame

file

path/filename ending with .xlsx (if NULL the resulting workbook is returned as an object rather than written to an xlsx file)

group

(Optional) tidy-selection of grouping column(s) for applying alternating shading

group_fill

(Optional) fill colour for alternating group shading (defaults to "#ffcccb")

date_format

openxlsx format for date-columns (defaults to "yyyy-mm-dd")

first_active_row

integer indicating first active row after the header (defaults to 2L)

zoom

integer specifying initial zoom percentage (defaults to 130)

overwrite

logical indicating whether to overwrite existing file (defaults to TRUE)

Value

If file = NULL returns an openxlsx workbook object. Otherwise writes workbook to file with no return.

Examples

1
2
3
4
5
6
data(ll)

## Not run: 
write_simple_xlsx(ll, "file_out.xlsx", group = site)

## End(Not run)

epicentre-msf/llutils documentation built on Nov. 9, 2020, 8:24 p.m.