1. 程式人生 > >R語言從github安裝recharts包

R語言從github安裝recharts包

這是困惑了一段時間的問題,之前一直在stackoverflow上面鼓搗,但是很久都沒有結果,今天又拿起來捉摸,天不負,有心人,問題是在github上面安裝R包是出現的,現在將問題貼在下面,

install.packages('recharts', repos = c('http://yihui.name/xran','http://cran.rstudio.com'))
Warning in install.packages :
  cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open
: HTTP status was '404 Not Found' Warning in install.packages : unable to access index for repository http://yihui.name/xran/bin/windows/contrib/3.2 installing the source package ‘recharts’ trying URL 'http://yihui.name/xran/src/contrib/recharts_0.0.3.tar.gz' Content type 'application/octet-stream' length 899632 bytes
(878 KB) downloaded 878 KB 'D:\Program' 不是內部或外部命令,也不是可執行的程式 或批處理檔案。 Warning in install.packages : running command '"D:/Program Files/R/R-3.2.2/bin/x64/R" CMD INSTALL -l "D:\Program Files\R\R-3.2.2\library" C:\Users\xgf-pc\AppData\Local\Temp\RtmpwDIN6k/downloaded_packages/recharts_0.0.3.tar.gz' had status 1
Warning in install.packages : installation of package ‘recharts’ had non-zero exit status The downloaded source packages are in ‘C:\Users\xgf-pc\AppData\Local\Temp\RtmpwDIN6k\downloaded_pa
ckages’
下面是我的機器資訊
sessionInfo()
R version 3.2.2(2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

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

other attached packages:[1] xlsx_0.5.7       xlsxjars_0.6.1   rJava_0.9-7      RODBC_1.3-12     data.table_1.9.6
 [6] dplyr_0.4.1      chron_2.3-47     sqldf_0.4-10     RSQLite_1.0.0    DBI_0.3.1       
[11] gsubfn_0.6-6     proto_0.3-10     shiny_0.12.2     devtools_1.9.1  

loaded via a namespace (and not attached):[1] Rcpp_0.12.1      rstudioapi_0.3.1 knitr_1.11       magrittr_1.5     xtable_1.8-0[6] R6_2.1.1         stringr_1.0.0    httr_1.0.0       tools_3.2.2      parallel_3.2.2  
[11] htmltools_0.2.6  assertthat_0.1   digest_0.6.8     curl_0.9.3       memoise_0.2.1   
[16] mime_0.4         stringi_1.0-1    jsonlite_0.9.17  httpuv_1.3.3

當時實驗了,實際上不止安裝recharts不成功,就是github上面的其他包也不行,今天查到說是R的安裝路徑有問題,安裝路徑中不能含有空格,於是我將R的路徑修改之後,問題果然得到了解決,著實感謝開源社群,現貼上結果
> install.packages(
+     'recharts',
+     repos = c('http://yihui.name/xran', 'http://cran.rstudio.com')
+ )
Warning in install.packages :
  cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
  cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
  unable to access index for repository http://yihui.name/xran/bin/windows/contrib/3.2
installing the source package ‘recharts’


trying URL 'http://yihui.name/xran/src/contrib/recharts_0.0.3.tar.gz'
Content type 'application/octet-stream' length 899632 bytes (878 KB)
downloaded 878 KB


* installing *source* package 'recharts' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (recharts)


The downloaded source packages are in
‘C:\Users\xgf-pc\AppData\Local\Temp\RtmpWaf8An\downloaded_packages’
> library("recharts", lib.loc="D:/Rlanguage/R/R-3.2.2/library")
希望對遇到問題的朋友有用