我试着遵循Will Chase的建议,将装入字体行放在.RProfile文件中,这样我就可以在习惯上装入ggplot2之前执行。his advice
不知何故,我遇到了这个有趣的现象,我写道:
if(interactive())
try(extrafont::loadfonts(device = "win"))RStudio给出了一个错误
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'windowsFonts' of mode 'function' was not found一定是幕后的魔法。一旦我把手放在控制台上,我就可以运行extrafont::loadfonts(device = "win"),它将使用windowsFonts()向R注册字体。
在解释.RProfile时,windowsFonts函数似乎不可用。不知道为什么,以及任何帮助,让我围绕这个问题的想法将不胜感激。
发布于 2021-01-23 07:59:17
回复太晚了,但我也有同样的问题,在读完这篇文章后,我想出了一个解决方案。windowsFonts()是grDevices库中的一个函数。extrafont导入grDevices,但由于某些原因,它在.Rprofile中运行时无法识别-它一定与R加载时的操作顺序有关。如果你加载grDevices,它就能工作。请参阅下面的代码。
library(extrafont)
loadfonts("win", quiet = F)
Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'windowsFonts' of mode 'function' was not found
Calls: <Anonymous> -> match.fun -> get
Execution haltedlibrary(grDevices)
library(extrafont)
loadfonts("win", quiet = F)
Registering fonts with Rhttps://stackoverflow.com/questions/58279537
复制相似问题