gpt4 book ai didi

r - 将 R_markdown 编织成 PDF 时加载命名空间出错

转载 作者:行者123 更新时间:2023-12-05 02:04:01 24 4
gpt4 key购买 nike

第一次使用R_Markdown

我创建了一个新的 R_Markdown 并试图将它编织成 PDF。当我这样做时,出现以下错误


processing file: R_markdown.Rmd
|.......... | 14%
ordinary text without R code

|.................... | 29%
label: setup (with options)
List of 1
$ include: logi FALSE

|.............................. | 43%
ordinary text without R code

|........................................ | 57%
label: cars
|.................................................. | 71%
ordinary text without R code

|............................................................ | 86%
label: pressure (with options)
List of 1
$ echo: logi FALSE

|......................................................................| 100%
ordinary text without R code


output file: R_markdown.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS R_markdown.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output R_markdown.tex --lua-filter "C:\Users\faiel\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\faiel\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in"
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'xfun' 0.17 is already loaded, but >= 0.19 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted

我不明白为什么会这样。我尝试了以下

install.packages("rmarkdown")

update.packages(ask = FALSE, checkBuilt = TRUE)
tinytex::tlmgr_update()

但没有任何运气

最佳答案

loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) 错误:namespace 'xfun' 0.17 已加载,但 >= 0.19 是必需的

如果您发现上述错误,您可以使用以下解决方案来消除错误。同样的方法可以用于任何包。(代替 xfun 任何包名都可以存在)。

解决方案:
在 RStudio 中,导航至 -> 工具 -> 检查包更新,您可以在此处选择包并进行更新。如果这不起作用,请更新 R 版本并尝试更新包。

通过执行上述方法,包将更新到较新的版本。

关于r - 将 R_markdown 编织成 PDF 时加载命名空间出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64701557/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com