以编程方式在 R Console 中设置字体和字体大小?

问题描述 投票:0回答:2

是否可以设置控制台字体和字体大小,就像我使用“编辑->GUI首选项”那样,以编程方式?这个功能会是什么样子?我在窗户上。

windows r user-interface console
2个回答
10
投票

在 Windows 上(至少),

$R_HOME/etc/Rconsole
配置文件为控制台和寻呼机设置许多可选参数。您可以手动编辑以下部分来更改默认字体和字体大小:

## Font.
# Please use only fixed width font.
# If font=FixedFont the system fixed font is used; in this case
# points and style are ignored. If font begins with "TT ", only
# True Type fonts are searched for.
font = TT Courier New
points = 10
style = normal # Style can be normal, bold, italic

要从活动 R 会话的命令行更改值,您可以使用

loadRconsole()
函数。它读取包含如上所示形式的指令的文本文件,这将覆盖 R 启动时从
Rconsole
读取的值。 这是一个例子:

temp <- tempfile()
cat("points = 13\n", file = temp)
cat("style = italic\n", file = temp, append = TRUE)
loadRconsole(file = temp)

## And then, to reset to the defaults:
loadRconsole(file = file.path(R.home(), "etc/Rconsole"))

0
投票

按住控制键并用滚轮向上滚动,就像 Word 文档或网页一样。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.