简体   繁体   English

R package extrafont::font_import() 未完成

[英]R package extrafont::font_import() not finishing

As I was writing up this question, I tricked myself into finding the (now fairly obvious) solution.当我写这个问题时,我欺骗自己找到了(现在相当明显的)解决方案。 However, since it caused me a lot of confusion, I figured I would leave this up to save other people time.然而,由于它给我带来了很多困惑,我想我会留下这个来节省其他人的时间。 I can't write my own answer, so if someone else wants to answer it I will mark it.我不能写自己的答案,所以如果其他人想回答它,我会标记它。 And no hard feelings if someone wants to mark this as obvious/duplicate/not a question.如果有人想将此标记为明显/重复/不是问题,也不会感到难过。 Basically, I "couldn't" see the y/n prompt because I wasn't looking at the console (I was doing this in R Notebook for no particular reason), and the function was endlessly waiting for me to respond.基本上,我“无法”看到 y/n 提示,因为我没有在看控制台(我在 R 笔记本中这样做,没有特别的原因),并且 function 无休止地等待我回应。 After I figured this out, font_import() finished after 5 minutes.在我弄清楚这一点后, font_import()在 5 分钟后完成。 Hope this is helpful to someone.希望这对某人有帮助。

Here is my question:这是我的问题:

I'm trying to set up the extrafont package in R so I can use Times New Roman in ggplot.我正在尝试在 R 中设置额外字体 package 以便我可以在 ggplot 中使用 Times New Roman。 I am using this as a reference: How to change font of ggplot into Times New Roman (on OS X)?我以此作为参考: 如何将 ggplot 的字体更改为 Times New Roman(在 OS X 上)? Here is what I have tried:这是我尝试过的:

library()
#font_import()
#font_import(pattern = "TIMES")
font_import(paths="C:\\Windows\\Fonts")

I let the first one run for 5 hours last night, and I tried the other ones this morning to maybe keep it from doing unnecessary work.昨晚我让第一个运行了 5 个小时,今天早上我尝试了其他的,以防止它做不必要的工作。 None of them finished.他们都没有完成。 However, I think something is going wrong for two reasons: 1) I don't get the prompt shown here: https://rdrr.io/cran/extrafont/man/font_import.html , and 2) my CPU and RAM utilization don't indicate that my computer is actually working on anything that should take some time.但是,我认为出现问题的原因有两个:1)我没有收到此处显示的提示: https://rdrr.io/cran/extrafont/man/font_import.html ,以及 2)我的 CPU 和 RAM 利用率不要表明我的计算机实际上正在处理任何需要一些时间的事情。

As I was writing up this question, I tricked myself into finding the (now fairly obvious) solution.当我在写这个问题时,我欺骗自己找到了(现在相当明显的)解决方案。 However, since it caused me a lot of confusion, I figured I would leave this up to save other people time.但是,由于它给我带来了很多困惑,我想我会保留它以节省其他人的时间。 I can't write my own answer, so if someone else wants to answer it I will mark it.我不能写我自己的答案,所以如果其他人想回答它,我会标记它。 And no hard feelings if someone wants to mark this as obvious/duplicate/not a question.如果有人想将此标记为明显/重复/不是问题,也不会感到难受。 Basically, I "couldn't" see the y/n prompt because I wasn't looking at the console (I was doing this in R Notebook for no particular reason), and the function was endlessly waiting for me to respond.基本上,我“无法”看到 y/n 提示,因为我没有看控制台(我在 R Notebook 中没有特别原因地这样做),并且该功能无休止地等待我响应。 After I figured this out, font_import() finished after 5 minutes.在我弄清楚这一点后, font_import()在 5 分钟后完成。 Hope this is helpful to someone.希望这对某人有帮助。

Here is my question:这是我的问题:

I'm trying to set up the extrafont package in R so I can use Times New Roman in ggplot.我正在尝试在 R 中设置 extrafont 包,以便我可以在 ggplot 中使用 Times New Roman。 I am using this as a reference: How to change font of ggplot into Times New Roman (on OS X)?我将其用作参考: 如何将 ggplot 的字体更改为 Times New Roman(在 OS X 上)? Here is what I have tried:这是我尝试过的:

library()
#font_import()
#font_import(pattern = "TIMES")
font_import(paths="C:\\Windows\\Fonts")

I let the first one run for 5 hours last night, and I tried the other ones this morning to maybe keep it from doing unnecessary work.昨晚我让第一个运行了 5 个小时,今天早上我尝试了其他几个,以防止它做不必要的工作。 None of them finished.他们都没有完成。 However, I think something is going wrong for two reasons: 1) I don't get the prompt shown here: https://rdrr.io/cran/extrafont/man/font_import.html , and 2) my CPU and RAM utilization don't indicate that my computer is actually working on anything that should take some time.但是,我认为出现问题的原因有两个:1)我没有得到此处显示的提示: https : //rdrr.io/cran/extrafont/man/font_import.html ,以及 2)我的 CPU 和 RAM 利用率不要表明我的计算机实际上正在处理需要一些时间的任何事情。

FYI, I had a similar issue (newbie to R), until I figured out that there was a prompt in the console.仅供参考,我遇到了类似的问题(R 的新手),直到我发现控制台中有提示。

If you wanna avoid having to wait to answer in the console every time, set如果您想避免每次都在控制台中等待回答,请设置

prompt=FALSE

https://www.rdocumentation.org/packages/extrafont/versions/0.18/topics/font_import https://www.rdocumentation.org/packages/extrafont/versions/0.18/topics/font_import

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM