在 ReporteRs R 包中,可以通过 R's 设置全局选项,例如字体系列和大小options()
。例如,如果我想将我的默认字体大小设置为 10 并使用 Arial 作为默认字体,我会使用
options('ReporteRs-fontsize' = 10, 'ReporteRs-default-font' = 'Arial Narrow')
鉴于officer
replace ReporteRs
,是否有任何类似的命令?
我通过将全局变量定义为我的 R 文件的顶部来做到这一点:例如:fontSize = 10
font = 'Arial Narrow'
然后在函数内部调用它: 下面是一个我用来改变我写的主题颜色的例子。
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)
然后在我的主题函数中调用它:
theme <- function(x, odd_body = inner_grey, header = header_colour, headerFont = "white",
even_body = "transparent" ){}