【问题标题】:Global options for officer R package军官 R 包的全局选项
【发布时间】:2019-06-03 12:51:54
【问题描述】:

在 ReporteRs R 包中,可以通过 R 的options() 设置全局选项,例如字体系列和大小。例如,如果我想将我的默认字体大小设置为 10 并使用 Arial 作为默认字体,我会使用

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

鉴于officer替换了ReporteRs,有没有类似的命令?

【问题讨论】:

    标签: r reporters officer


    【解决方案1】:

    我通过将全局变量定义为我的 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" ){}
    

    【讨论】:

      猜你喜欢
      • 2018-08-28
      • 2017-06-16
      • 2016-05-02
      • 2012-06-04
      • 2020-10-24
      • 1970-01-01
      • 2020-08-27
      • 2014-10-05
      • 2012-09-17
      相关资源
      最近更新 更多