Rstudio内的R找不到rmarkdown包

时间:2014-07-14 09:28:15

标签: r markdown rstudio

我试图在PC上的Rstudio(0.98.953)中首次使用rmarkdown。我已升级到R(3.1.1)和R studio的最新版本。 sessionInfo()的输出在此问题的末尾提供。

据我了解,rmarkdown应该包含在Rstudio中。但是,当我选择在Rstudio中创建markdown文档时,会弹出一个对话框,说明需要安装其他软件包。 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

我认为这与在我工作的地方使用托管桌面有关。然而,这通常不是问题,因为对这些机器的限制远少于通常的情况,并且所有其他软件包,软件等往往起作用。

我也试过直接从github安装rmarkdown。安装程序再次无法识别软件包rmarkdown本身。

可能是错误的原因是什么?

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

尝试直接从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'

3 个答案:

答案 0 :(得分:8)

尝试运行此代码以获取最新版本的rmarkdown软件包,这应解决此问题:

Ext.define('MyApp.store.MobilePrefix', {
extend: 'Ext.data.Store',
requires: ['MyApp.model.MobilePrefix'],
autoLoad: true,
config: {
    model: 'MyApp.model.MobilePrefix',
    proxy: {
        type: 'ajax',
        url: 'resources/data/MobilePrefix.json',


        reader: {
            type: 'json',
            rootProperty: 'MobilePrefix'
        }
    },
    listeners: {
        load: function(store) {
            console.log(store.data);
        }

    }
}
});

问题是RStudio IDE会查看在更新rmarkdown软件包之前拍摄的静态CRAN快照。有关详细信息,请参阅此链接:https://groups.google.com/forum/#!topic/rropen/Kgg8z6FF40I

答案 1 :(得分:2)

我想知道问题是否是为install_github命令的--library选项显示的路径中的空间。我知道你之前已经安装了包好的,但是我的设置听起来很像你的,而且rmarkdown对我有效。我在Win7上有RStudio 0.98.953,这是一个非常锁定的企业机器。我通过将env变量R_LIBS设置为我的网络主驱动器来强制让我安装R软件包。加载包很慢,但我别无选择,因为我无法写入C:驱动器。所以,我的install_github命令有--library =" H:/ Rlib"。你的道路有"我的文件"嵌入其中。我不是肯定的问题,但是我的github安装" rstudio / rmarkdown"确实成功了。当我做文件 - >新文件 - > R Markdown,然后按下" Knit HTML"按钮,也成功完成。

RStudio github页面https://github.com/rstudio/rmarkdown#installation听起来好像在RStudio中手动安装rmarkdown并不是必需的,但无论如何我都是这样做的,因为我并不总是使用R来通过RStudio。抱歉,在手动安装软件包之前,我没有通过制作新的R Markdown文件来测试RStudio。

RStudio博客文章http://blog.rstudio.org/2014/06/18/r-markdown-v2/清楚地表明,rmarkdown软件包旨在取代之前的降价软件包。 rmarkdown软件包似乎尚未出现在CRAN上,因此需要install_github。

答案 2 :(得分:1)

最适合我的是退出Rstuido,然后在基础R(不是任何IDE)中安装rmarkdown软件包并重新启动Rstudio。

我在Windows 10,R 3.3.1,Rstudio版本0.99.903