Rmarkdown找不到库路径

时间:2017-12-26 23:44:14

标签: r bash r-markdown

使用macOS 10.12,我试图从终端编织Rmd文件。我刚刚从自制软件中安装了R,但是当我尝试以下内容时:

$ Rscript -e "rmarkdown::render('test.Rmd')"

出现错误:

Error in loadNamespace(name) : there is no package called ‘rmarkdown’
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

我假设,基于此related question,需要导出库。

所以我在R Studio中尝试过:

> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.3/Resources/library"

然后在终端:

$ export R_LIB= usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library

但这会引发错误:

-bash: export: `usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library': not a valid identifier

有关如何从这里开始的任何建议将非常感谢!

1 个答案:

答案 0 :(得分:1)

在bash中分配时,Error in vecseq(f__, len__, if (allow.cartesian || notjoin || !anyDuplicated(f__, : Join results in 141691725 rows; more than 1352680 = nrow(x)+nrow(i). Check for duplicate key values in i each of which join to the same group in x over and over again. If that's ok, try by=.EACHI to run j for each group to avoid the large allocation. If you are sure you wish to proceed, rerun with allow.cartesian=TRUE. Otherwise, please search for this error message in the FAQ, Wiki, Stack Overflow and datatable-help for advice. 符号周围不能有空格。这是&#34;不是有效标识符的原因&#34;错误。

=

这将解决您的Bash问题,但我不确定您在R中尝试完成的任务。我发现您不太可能拥有export R_LIB=usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library 目录。您可以设置名为usr/Library的{​​{3}}告诉R在哪里查找用户特定的库,以及R_LIBS_USER

  

库搜索路径在启动时从环境变量R_LIBS(应该是以R为结尾的冒号分隔的目录列表)进行初始化,然后是环境变量R_LIBS中的那些。只包含当时存在的目录。

     

默认情况下,R_LIBS_USER未设置,R_LIBS设置为主目录的目录“R_LIBS_USER”(或CRAN macOS版本的“R/R.version$platform-library/x.y”), R x y z

我怀疑你可能在寻找:

Library/R/x.y/library

或者,如果它是用户特定的:

export R_LIBS=/Library/Frameworks/R.framework/Versions/3.3/Resources/library
相关问题