尝试安装 rmarkdown 包给我错误

Attempting to install rmarkdown package gives me the error

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.13 is being loaded, but >= 0.15 is required
ERROR: lazy loading failed for package 'knitr'
* removing 'C:/Users/mazen/Documents/R/win-library/3.5/knitr'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘knitr’ had non-zero exit status
ERROR: dependency 'knitr' is not available for package 'rmarkdown'
* removing 'C:/Users/mazen/Documents/R/win-library/3.5/rmarkdown'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘rmarkdown’ had non-zero exit status

您需要安装更新版本的 xfun:

install.packages('xfun')

不过,你的R版本太旧了(3.5.x)。使用这个旧版本的 R,您无法访问 CRAN 的 xfun 的预构建二进制版本。您的两个选择是:

  1. 要么升级R;
  2. 或安装 Rtools.

除非你处在一个阻止你升级R的锁定环境中,否则我强烈建议你升级R,而不是为旧版本的R安装Rtools。