1. 程式人生 > 其它 >ubuntukylin-18.04.5下安裝R包recharts

ubuntukylin-18.04.5下安裝R包recharts

安裝失敗原因:實驗課時虛擬機器網路連線手機熱點導致無法訪問GitHub,在從GitHub下載安裝recharts包時失敗(),命令及錯誤資訊如下:


> require(devtools)
載入需要的程輯包:devtools
載入需要的程輯包:usethis
> install_github("taiyun/recharts") 
錯誤: Failed to install 'unknown package' from GitHub:
OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.

解決方法:

1. 連線校園網後可正常訪問GitHub,登陸虛擬機器後,在R中重新安裝recharts包,安裝成功!

> require(devtools)
載入需要的程輯包:devtools
載入需要的程輯包:usethis
> 
> install_github("taiyun/recharts")
Downloading GitHub repo taiyun/recharts@HEAD
   checking for file ‘/tmp/Rtmpf2vfex/remotes159a683d195/cosname-recharts-646daf✔  checking for file ‘/tmp/Rtmpf2vfex/remotes159a683d195/cosname-recharts-646dafb/DESCRIPTION’ (439ms)
─  preparing ‘recharts’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Removed empty directory ‘recharts/screenshots’
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘recharts_0.0.4.tar.gz’
   
Installing package into ‘/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
* installing *source* package ‘recharts’ ...
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (recharts)
> library(recharts)
> 
> q()

2.部分同學Ubuntu虛擬機器無法使用校園網,可以從GitHub:https://github.com/taiyun/recharts上下載得到原始碼包 recharts-master.zip 解壓、編譯安裝。具體流程實現如下:

(1)獲取R包儲存路徑,在R中輸入.libPaths();

> .libPaths()
[1] "/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4"
[2] "/usr/local/lib/R/site-library"                 
[3] "/usr/lib/R/site-library"                       
[4] "/usr/lib/R/library"

(2)解壓原始碼包 recharts-master.zip;

$ unzip ~/下載/recharts-master.zip  /usr/local/
$ ls /usr/local/
bigdatacase  games   hive     man              share
bin          hadoop  include  recharts-master  src
etc          hbase   lib      sbin             vmware-tools-distrib

(3)編譯安裝recharts包;

$ R CMD INSTALL /usr/local/recharts-master  --library=/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4
* installing *source* package ‘recharts’ ... ** R ** data *** moving datasets to lazyload DB ** demo ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded * DONE (recharts)

(4)進入R,匯入recharts包;安裝成功。

> library(recharts)
> 
> q()