简体   繁体   中英

Global options for officer R package

In the ReporteRs R package, one could set global options such as font family and size through R's options() . For instance, if I wanted to set my default fontsize to 10 and use Arial as a default font, I'd use

options('ReporteRs-fontsize' = 10, 'ReporteRs-default-font' = 'Arial Narrow')

Given that officer replaced ReporteRs , is there any similar command?

I do this by defining the global variable as the top of my R file: eg: fontSize = 10

font = 'Arial Narrow'

Then just calling this inside the function: Below is an example I use to change the colours of the theme I wrote.

header_colour <- rgb(143, 102, 51, max = 255)
border_colour <- rgb(184, 79, 64, max = 255)
inner_grey <- rgb(130, 130, 130, max = 255)
std_b <- fp_border(color="black", width = 2)

Then calling this inside my theme function:

theme <- function(x, odd_body = inner_grey, header = header_colour, headerFont = "white",
                      even_body = "transparent" ){}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM