r - 安装 xfun 的问题(对于 rmarkdown)
问题描述
我正在为 Rstudio 的完全新手编写 Rstudio 教程。要使用 learnr 运行教程,学生需要安装 learnr 和 rmarkdown。但是我遇到了 xfun 的问题,它是 rmarkdown 的依赖项之一。安装 xfun 给了我一个旧版本 (0.22),但安装 tinytex 和 rmarkdown 需要更高版本 (>=0.23)。我现在已经在几台装有最新版本 R 的 Windows 计算机上尝试过这个,并且遇到了同样的问题。
解决方法:在我自己的计算机上,我下载了 xfun 源代码的 .zip 文件,并通过转到工具 -> 安装包手动将其安装到 RStudio... 但是,这似乎太复杂,无法引导学生完成开始基础教程。
有谁知道一种轻松(用一两行代码)强制 R 安装最新版本的 xfun 的方法?我希望能够让我的学生将命令复制到 R 中,以便他们可以安装必要的软件包并运行 rmarkdown/learnr 教程。
这是我尝试安装学习器时得到的输出:
> install.packages("learnr")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/kyrad/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘tinytex’, ‘xfun’, ‘rmarkdown’
There are binary versions available but the
source versions are later:
binary source needs_compilation
tinytex 0.31 0.34 FALSE
xfun 0.22 0.26 TRUE
rmarkdown 2.8 2.11 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/xfun_0.22.zip'
Content type 'application/zip' length 323923 bytes (316 KB)
downloaded 316 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/learnr_0.10.1.zip'
Content type 'application/zip' length 1661500 bytes (1.6 MB)
downloaded 1.6 MB
package ‘xfun’ successfully unpacked and MD5 sums checked
package ‘learnr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\kyrad\AppData\Local\Temp\Rtmpmwhs1M\downloaded_packages
installing the source packages ‘tinytex’, ‘rmarkdown’
trying URL 'https://cran.rstudio.com/src/contrib/tinytex_0.34.tar.gz'
Content type 'application/x-gzip' length 30196 bytes (29 KB)
downloaded 29 KB
trying URL 'https://cran.rstudio.com/src/contrib/rmarkdown_2.11.tar.gz'
Content type 'application/x-gzip' length 3212367 bytes (3.1 MB)
downloaded 3.1 MB
* installing *source* package 'tinytex' ...
** package 'tinytex' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'xfun' 0.22 is being loaded, but >= 0.23 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'tinytex'
* removing 'C:/Users/kyrad/OneDrive/Documents/R/win-library/3.6/tinytex'
Warning in install.packages :
installation of package ‘tinytex’ had non-zero exit status
ERROR: dependency 'tinytex' is not available for package 'rmarkdown'
* removing 'C:/Users/kyrad/OneDrive/Documents/R/win-library/3.6/rmarkdown'
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\kyrad\AppData\Local\Temp\Rtmpmwhs1M\downloaded_packages’
解决方案
推荐阅读
- javascript - 嵌套循环 JavaScript 未按预期循环
- c++ - C++ - 具有链表和一次执行一个函数的类的程序
- java - 在javafx中将Shape从awt转换为Shape
- sql-server - 将 Varchar 日期转换为日期数据类型
- javascript - 编译失败:解析错误:意外的令牌,预期的“;”
- php - 如何用用户名添加计数?
- php - 如何在 Laravel 5.6 中打印与其品牌名称相关的所有型号名称?
- pyspark - 从 pyspark agg 函数到 int
- javascript - 如何使用 javascript 将某些内容传递到新页面?
- ruby - `each` 方法何时以及如何工作?