为什么我在安装rmarkdown时遇到此错误

时间:2016-05-03 09:56:58

标签: r rstudio knitr r-markdown

我尝试使用rmarkdown,到目前为止我遇到了很多麻烦。第一个是当Rstudio好像应该安装新版本的软件包时。它无法超越它。我试图逐个安装所有必需的软件包,但是我收到了这个错误

 trying URL 'https://cran.rstudio.com/bin/windows/contrib/2.15/knitr_1.5.zip'
Content type 'application/zip' length 910172 bytes (888 Kb)
opened URL
downloaded 888 Kb

package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘digest’ successfully unpacked and MD5 sums checked
package ‘formatR’ successfully unpacked and MD5 sums checked
package ‘highr’ successfully unpacked and MD5 sums checked
package ‘markdown’ successfully unpacked and MD5 sums checked
package ‘stringr’ successfully unpacked and MD5 sums checked
package ‘knitr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\mali\AppData\Local\Temp\Rtmpcz1Ywk\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found

我逐个安装了软件包,我可以加载它们,但它不能作为一个整体工作。文件 - >新的 - > rmarkdown

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Swedish_Sweden.1252  LC_CTYPE=Swedish_Sweden.1252    LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C                   
[5] LC_TIME=Swedish_Sweden.1252    

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

other attached packages:
[1] rmarkdown_0.9.6 knitr_1.12.3   

loaded via a namespace (and not attached):
[1] digest_0.6.9    htmltools_0.3.5 Rcpp_0.12.4     tools_3.1.2 

我最近发现我在启动Rstudio时收到了这样的消息

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found
> 

我做@DAV推荐。试图安装其他版本。没有成功

> url <- "https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.0.tar.gz"
> install.packages(url, repos=NULL, type="source")
Installing package into ‘\\xxx/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.0.tar.gz'
Content type 'application/x-gzip' length 451348 bytes (440 Kb)
opened URL
downloaded 440 Kb

* installing *source* package 'knitr' ...
** package 'knitr' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Warning in file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
  there is no package called 'knitr'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\xxxxxx/users/Eke/mali/Documents/R/win-library/3.1/knitr'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-31~1.2/bin/i386/R" CMD INSTALL -l "\\xxxxx\users\Eke\mali\Documents\R\win-library\3.1" "C:/Users/mali/AppData/Local/Temp/RtmpoN1qrM/downloaded_packages/knitr_1.0.tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘C:/Users/mali/AppData/Local/Temp/RtmpoN1qrM/downloaded_packages/knitr_1.0.tar.gz’ had non-zero exit status
它让我发疯了。我卸载了“knitr”并尝试重新安装。 ERROR

> install.packages("knitr", dependencies = F)
Installing package into ‘\\xxxx.se/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.1/knitr_1.12.3.zip'
Content type 'application/zip' length 812186 bytes (793 Kb)
opened URL
downloaded 793 Kb

package ‘knitr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\mali\AppData\Local\Temp\RtmpaChLQ5\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found

当我想安装shiny

时就发生了
> install.packages("shiny", dependencies = F)
Installing package into ‘\\xxxxx.xxx/users/Eke/mali/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.1/shiny_0.13.2.zip'
Content type 'application/zip' length 2257481 bytes (2.2 Mb)
opened URL
downloaded 2.2 Mb

package ‘shiny’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\mali\AppData\Local\Temp\RtmpC0nOFC\downloaded_packages
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
  no package 'knitr' was found

1 个答案:

答案 0 :(得分:2)

您可以通过test_dict = {'path': '/home/user/user_name','device1': {'IP': '10.10.10.10','password': 'pwd1','username': 'user1','name':'USER_DEFINED'},'device2': {'IP': '11.11.11.11','password': 'pwd2','username': 'user2','name':'USER_DEFINED_TEST'}} keys_to_be_updated = "path,device1/name,device2/name" values_to_be_updated = "/home/user/user_name/ABCD,USER_TESTER1,USER_TESTER2" k = 0 list_of_values = values_to_be_updated.split(",") if keys_to_be_updated != "": for i in keys_to_be_updated.split(","): for j in i.split("/"): tmp = "['"+str(j)+"']" # test_dict[tmp] = list_of_values[k] # How to assign values to multi level dictionary here # test_dict['path'] = list_of_values[k] # test_dict['device1'][name'] = list_of_values[k] # test_dict['device2'][name'] = list_of_values[k] k = k+1 告诉RStudio您图书馆的位置 命令然后手动选择.libPaths()以及通过屏幕上的“软件包”窗口在RStudio中使用“rmarkdown”文档所需的其他软件包。

knitr
相关问题