r - 军官 R 包的全局选项
问题描述
在 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" ){}
推荐阅读
- java - 如何处理非标准 Apdu?
- python - TensorFlow 中多输入模型的优化
- excel - 使用多个条件返回特定值的公式?
- c++ - 无法从多线程中受益并且不知道为什么
- keras - 为什么即使在导入 tensorflow2 之后还要再次导入 keras?
- powershell - Powershell:如何将值添加到只有 1 个标头的对象
- azure-cosmosdb - 如何在 CosmosDB 中将不同的值作为单个文档获取
- php - 如何使用 php 抓取表数据并将其加载到数据库表中
- javascript - 如何在给定种子的范围内获得稳定的随机数?
- sql - 在 Oracle 视图中应用过滤器