【发布时间】:2021-12-18 15:21:20
【问题描述】:
在尝试安装 GGplot 包后,当我尝试在 R 中编织我的文档时,我不断收到此错误。
错误出现在第 71 行,但第 71 行没有代码。当我运行该部分时,我在控制台中收到此消息:
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/ggplot2_3.3.5.tgz'
Content type 'application/x-gzip' length 4125542 bytes (3.9 MB)
==================================================
downloaded 3.9 MB
The downloaded binary packages are in
/var/folders/km/tr6lt7kx6h71d83606qh91hc0000gn/T//Rtmp4M6La0/downloaded_packages
RStudio Community is a great place to get help: https://community.rstudio.com/c/tidyverse
【问题讨论】:
-
options("repos")在控制台上显示什么?如果然后将其插入到install.packages(.)之前的块中,然后编织,它会显示相同的内容吗? -
顺便说一句,如果您认为
ggplot2可能可用(即,它不打算每次都在 vanilla/empty VM 或 docker 映像中运行),您可以考虑替换 @987654331 @ 和if (!requireNamespace("ggplot2", quietly=TRUE)) install.packages("ggplot2"):如果它可用,那么您不需要花费时间/精力重新编译和/或重新安装它。 (仅供参考,library和require*之间的区别:stackoverflow.com/a/51263513/3358272、yihui.org/en/2014/07/library-vs-require 和 r-pkgs.org/namespace.html#search-path.) -
参见community.rstudio.com/t/rmd-install-packages-best-practices/… tl;dr 是:不要在 Rmd 文档中包含安装包的行。
标签: r r-markdown