简体   繁体   English

Rstudio内的R找不到rmarkdown包

[英]R within Rstudio cannot find rmarkdown package

I am trying to use rmarkdown, within Rstudio (0.98.953) on a PC, for the first time. 我试图在PC上的Rstudio(0.98.953)中使用rmarkdown,这是第一次。 I have upgraded to the latest versions of R (3.1.1) and R studio. 我已升级到R(3.1.1)和R studio的最新版本。 The output from sessionInfo() is provided at the end of this question. sessionInfo()的输出在此问题的末尾提供。

As I understand it rmarkdown should be included within Rstudio. 据我所知,rmarkdown应该包含在Rstudio中。 However, when I select to create a markdown document in Rstudio, a dialog box pops up saying additional packages need to be installed. 但是,当我选择在Rstudio中创建markdown文档时,会弹出一个对话框,说明需要安装其他软件包。 The installation of rmarkdown always then fails, with the following message: rmarkdown的安装总是失败,并显示以下消息:

Installing package into '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My        Documents/R/win-library/3.1'
(as 'lib' is unspecified)
* installing *source* package 'rmarkdown' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return =     TRUE) :
  there is no package called 'rmarkdown'
Error: loading failed
Execution halted
*** arch - x64
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return =     TRUE) :
  there is no package called 'rmarkdown'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win-    library/3.1/rmarkdown'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" CMD INSTALL -l "\\cfsk18.campus.gla.ac.uk\SSD_Home_Data_X\jm383x\My Documents\R\win-library\3.1"     "C:/PROGRA~1/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz"' had status 1 
2: In utils::install.packages("C:/Program     Files/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz",      :
  installation of package     'C:/PROGRA~1/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz' had non-zero exit status

I assume this is something to do with using a managed desktop in my place of work. 我认为这与在我工作的地方使用托管桌面有关。 However this is not usually a problem as far fewer restrictions are placed on these machines than is usually the case, and all other packages, software etc tend to work. 然而,这通常不是问题,因为对这些机器的限制远少于通常的情况,并且所有其他软件包,软件等往往起作用。

I have also tried installing rmarkdown directly from github. 我也试过直接从github安装rmarkdown。 Again the installer cannot identify the package rmarkdown itself. 安装程序再次无法识别软件包rmarkdown本身。

What is likely to be the cause of the error? 可能是错误的原因是什么?

SessionInfo output: SessionInfo输出:

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252        LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.1.1

Attempt to install directly from github repo: 尝试直接从github repo安装:

devtools::install_github("rstudio/rmarkdown")
Installing github repo rmarkdown/master from rstudio
Downloading master.zip from https://github.com/rstudio/rmarkdown/archive/master.zip
Installing package from C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv/master.zip
Installing rmarkdown
Installing dependencies for rmarkdown:
httpuv
Installing package into ‘\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My     Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/httpuv_1.3.0.zip'
Content type 'application/zip' length 857357 bytes (837 Kb)
opened URL
downloaded 837 Kb

package ‘httpuv’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv\downloaded_packages
"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" --vanilla CMD INSTALL  \
  "C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv\devtoolscec10833677\rmarkdown-master"       \
  --library="\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win-   library/3.1" --install-tests 

* installing *source* package 'rmarkdown' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
    Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return =     TRUE) :
      there is no package called 'rmarkdown'
    Error: loading failed
    Execution halted
    *** arch - x64
     Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
  there is no package called 'rmarkdown'
    Error: loading failed
    Execution halted
    ERROR: loading failed for 'i386', 'x64'
* removing '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win-      library/3.1/rmarkdown'

Try running this code to get the latest version of the rmarkdown package, which should solve the issue: 尝试运行此代码以获取最新版本的rmarkdown软件包,这应该可以解决问题:

install.packages("rmarkdown", repos = "https://cran.revolutionanalytics.com")

The issue is that the RStudio IDE looks at a static CRAN snapshot that was taken before the rmarkdown package was updated. 问题是RStudio IDE会查看在更新rmarkdown软件包之前拍摄的静态CRAN快照。 For more information, see this link: https://groups.google.com/forum/#!topic/rropen/Kgg8z6FF40I 有关详情,请访问以下链接: https//groups.google.com/forum/#!topic / rropen / Kgg8z6FF40I

I wonder if the problem is the space in the path shown for the --library option to your install_github command. 我想知道问题是否是为install_github命令的--library选项显示的路径中的空间。 I know you say you've installed packages OK before, but my setup sounds just slike yours and rmarkdown works for me. 我知道你之前说过你已经安装了包,但是我的设置听起来很像你的,rmarkdown对我有用。 I have RStudio 0.98.953 on Win7, which is a very locked-down corporate machine. 我在Win7上有RStudio 0.98.953,这是一个非常锁定的企业机器。 I've coerced it into letting me install R packages by setting the env variable R_LIBS to my network home drive. 我强迫它让我通过将env变量R_LIBS设置为我的网络主驱动器来安装R软件包。 Loading packages is slow, but I have no choice because I cannot write to the C: drive. 加载包很慢,但我别无选择,因为我无法写入C:驱动器。 So, my install_github command has --library="H:/Rlib". 所以,我的install_github命令有--library =“H:/ Rlib”。 Your path has "My Documents" embedded in it. 您的路径中嵌入了“我的文档”。 I'm not positive that's the problem, but my github installation of "rstudio/rmarkdown" did succeed. 我不肯定这是问题,但我的github安装“rstudio / rmarkdown”确实成功了。 When I do File -> New File -> R Markdown, followed by a press of the "Knit HTML" button, that also completes successfully. 当我执行文件 - >新文件 - > R Markdown,然后按下“编织HTML”按钮,也成功完成。

The RStudio github page https://github.com/rstudio/rmarkdown#installation makes it sound like manual installation of rmarkdown in RStudio isn't required, but I did it anyway because I don't always use R through RStudio. RStudio github页面https://github.com/rstudio/rmarkdown#installation听起来好像不需要手动安装RStudio中的rmarkdown,但我还是做了,因为我并不总是使用R来通过RStudio。 Sorry, but I didn't test RStudio by making a new R Markdown file before I manually installed the package. 抱歉,在手动安装软件包之前,我没有通过制作新的R Markdown文件来测试RStudio。

The RStudio blog post http://blog.rstudio.org/2014/06/18/r-markdown-v2/ says clearly that the rmarkdown package is intended to replace the previous markdown package. RStudio博客文章http://blog.rstudio.org/2014/06/18/r-markdown-v2/清楚地表明rmarkdown软件包旨在取代之前的降价软件包。 The rmarkdown package does not yet appear to be on CRAN, so install_github is necessary. rmarkdown软件包似乎尚未出现在CRAN上,因此需要install_github。

The best that worked for me is to quit Rstuido, then install rmarkdown package in the base R (not any IDE) and restarting Rstudio. 对我有用的最好的是退出Rstuido,然后在基础R(不是任何IDE)中安装rmarkdown软件包并重新启动Rstudio。

I am on Windows 10, R 3.3.1, Rstudio Version 0.99.903 我在Windows 10,R 3.3.1,Rstudio版本0.99.903

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM