在tidyverse的styler包中,首次运行时,style_文本提示用户输入 >packageVersion('styler')) [1] ‘1.3.2’ >样式\u文本(“A
确实会产生不需要的消息和提示:在tidyverse的styler包中,首次运行时,style_文本提示用户输入 >packageVersion('styler')) [1] ‘1.3.2’ >样式\u文本(“A,r,tidyverse,R,Tidyverse,确实会产生不需要的消息和提示: The R.cache package needs to create a directory that will hold cache files. It is convenient to use '<xxxx>/Caches/R/R.cache' because it follows the standard on your operating system and it remains also after restarting R. Do y
The R.cache package needs to create a directory that will hold cache files. It is
convenient to use '<xxxx>/Caches/R/R.cache' because it follows the standard on your
operating system and it remains also after restarting R. Do you wish to create the
'<xxxx>/Caches/R/R.cache' directory? If not, a temporary directory (/var/folder
/47/4_fn5xyx01b8_8bnyn8cpv3c0000gn/T//RtmpdO3NGa/.Rcache) that is specific to this
R session will be used. [Y/n]:
产生
A <- 1
ATLDR;
在调用目录应该已经存在的{styler}
之前,请执行以下操作:
选项(R.cache.rootPath='/path/to/your/cache/dir')
您有以下选项:
完全停用缓存
首先,您可以通过使用styler::cache\u deactivate()
将缓存问题全部停用,从而消除缓存问题。然后,提示不应出现。要使此问题永久存在,请将此行放入.r配置文件中
以编程方式设置缓存
但是,如果您想从缓存带来的设置速度中获益,可以通过编程方式进行设置。我支持(如果您有意见,请告诉我):
在某些情况下,您希望避免上述交互式提示。在这种情况下,您可以在调用{styler}之前,使用R选项R.cache.rootPath
或环境变量R\u cache\u rootPath
将缓存路径设置为现有路径
API。这应该避免出现提示。R.cache::setCacheRootPath(“/path/to/cache”)
也是编程的,但如果以交互方式调用,可能会给出提示
所以只需执行选项(R.cache.rootPath='/path/to/your/cache/dir')
您还可以通过设置选项styler.colored\u print.vertical
(print.vertical,package='styler')
使漂亮的颜色警告静音(如果您不想安装)
此外,在styler>1.3.2
中有一个styler.quiet
选项,但它可能不会产生任何影响,因为您看到的内容直接来自{R.cache}
将是对R.cache::setCacheRootPath()的早期调用
解决问题?@Limey运行该功能时,只会向用户提示相同的消息。提示不会消失
R.cache::setCacheRootPath("<xxxx>/Caches/R/R.cache")
style_text("A <- 1")
A <- 1