2016-05-03 50 views
1

我嘗試使用,到目前爲止我有很多麻煩。第一個是當Rstudio好像應該安裝新版本的軟件包時。它不能超越它。我試圖安裝一個個都需要的包,但比我得到這個錯誤爲什麼我得到這個錯誤安裝rmarkdown

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 

我一個安裝的軟件包之一,我可以加載它們,但它沒有作爲一個整體I.R.工作文件 - >新建 - > 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 
+0

你有沒有RStudio運行?如果是這樣,你是否從控制檯嘗試install.packages(「knitr」)? – lawyeR

+0

我試過不同的組合 – Mateusz1981

+0

你需要版本1.5嗎?我剛安裝了knitr,我得到的版本是1.12.3。這是您在sessionInfo輸出中顯示的版本。 – DAV

回答

2

你可以告訴RStudio通過.libPaths() 命令庫的位置,然後手動選擇knitr和必要的其他包使用RStudio中的「rmarkdown」文檔通過屏幕上的Packages窗口。

getwd() 

# "C:/Users/s146753/Dropbox/Chapter 2" 

.libPaths() 

# "\\\\home2.bio.ed.ac.uk/s146753/R/win-library/3.3" "C:/Program Files/R/R-3.3.2/library" 

.libPaths("C:/Program Files/R/R-3.3.2/library") 
.libPaths() 

# "C:/Program Files/R/R-3.3.2/library" 
相關問題