一、进入R shell后要安装rredis(rredis: "Redis" Key/Value Database Client R client interface to the "Redis" key-value database.)
二、命令:install.packages("rredis")
可能会出现
install.packages("rredis")
将程序包安装入‘/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4’
(因为‘lib’没有被指定)
Warning: 无法在貯藏處https://cloud.r-project.org/src/contrib中读写索引:
无法打开URL'https://cloud.r-project.org/src/contrib/PACKAGES'
再次尝试
install.packages("rredis")
将程序包安装入‘/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4’
(因为‘lib’没有被指定)
试开URL’https://cloud.r-project.org/src/contrib/rredis_1.7.0.tar.gz'
Error in download.file(url, destfile, method, mode = "wb", ...) :
无法打开URL'https://cloud.r-project.org/src/contrib/rredis_1.7.0.tar.gz'
此外: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
URL 'https://cloud.r-project.org/src/contrib/rredis_1.7.0.tar.gz': status was 'Timeout was reached'
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
下载程序包‘rredis’时出了问题
再次尝试
install.packages("rredis")
将程序包安装入‘/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4’
(因为‘lib’没有被指定)
Warning message:
package ‘rredis’ is not available (for R version 3.4.4)
三、连续多次尝试后,花费了很多时间,真的开始怀疑是版本不兼容的问题了
开始搜索怎么手动安装rredis,无奈,自己太菜,网上没有任何资料,也不知道怎么装,在找找别人的经验
是篇英文,不难懂
————————————————————————————————————————————————————--
The default version of `install.packages` somehow stopped working for me on latest version of R. In fact this is regardless of the version of R. I remember having same problem with the older versions of R as well.
Here is the screen shot of the warning. if you are having similar problem, keep on reading.
Anyways, long story short, as everyone knows, if you want to install a package on R, you use:
install.packages('package-name') |
And it asks you to pick a mirror repository to search the package in. If you are like me, picking the Cloud, you will soon realize, it will give you a misleading warning that the package is not available for your installed version of R. Well, this is not entirely true based on my experience.
I think not all the repositories include same packages (or versions) for some reason, that’s something I need to confirm it with R support team. If you select different mirror from previous step, and you are lucky enough, you might be able to install the package without any further problem/headache.
I usually use the following code to install package from R and it works 99% of the time.
install.packages('package-name',repos='http://cran.us.r-project.org') |
There are several mirrors available you can try, simply change the reposfield on the code above. Find the list of the mirrors here.
You still have problem installing the R package? See my other post here.
Feel free to share your experience, or the mirror works for you the best commenting below.
———————————————————————————————————————————————————————
四、按照这篇英文博客,尝试了一下,哇,真的还成功了,恩,现在我用这个命令行成功的几率是100%,我和喜欢
I usually use the following code to install package from R and it works 99% of the time.
(我经常用下面的代码去安装R的包,并且99%都成功了)
install.packages('package-name',repos='http://cran.us.r-project.org') |
恩,再说一遍,成功了
install.packages('rredis',repos='http://cran.us.r-project.org')
将程序包安装入‘/home/hadoop/R/x86_64-pc-linux-gnu-library/3.4’
(因为‘lib’没有被指定)
试开URL’http://cran.us.r-project.org/src/contrib/rredis_1.7.0.tar.gz'
Content type 'application/x-gzip' length 222376 bytes (217 KB)
==================================================
downloaded 217 KB
* installing *source* package ‘rredis’ ...
** 成功将‘rredis’程序包解包并MD5和检查
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c libsock.c -o libsock.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rredis.so libsock.o -L/usr/lib/R/lib -lR
installing to /home/hadoop/R/x86_64-pc-linux-gnu-library/3.4/rredis/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (rredis)
下载的程序包在
‘/tmp/RtmpxoX2rx/downloaded_packages’里