先说最有可能成功的一种吧
先安装下面几个包,载入
library(zoo)
library(xts)
library(lattice)
library(sp)
去下面这个网站下载
http://cas.uqam.ca/pub/src/contrib/CASdatasets_1.0-11.tar.gz
下载完以后手动安装
选择Install from Package Archive File
Browse选择前面下载的包的地址
下附上成功安装导入代码
> install.packages("D:/software/R-4.2.2/library/CASdatasets_1.0-11.tar.gz", repos = NULL, type = "source")
* installing *source* package 'CASdatasets' ...
** using staged installation
** data
** inst
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (CASdatasets)
> library(CASdatasets)
> > data(lossalae)
> head(lossalae)
Loss ALAE
1 10 3806
2 24 5658
3 45 321
4 51 305
5 60 758
6 74 8768
其他几种方法——未成功
#一
install.packages("CASdatasets", repos = "http://cas.uqam.ca/pub/", type="source")
#二
install.packages("CASdatasets", repos = "http://dutangc.perso.math.cnrs.fr/RRepository/", type="source")
#三
install.packages("CASdatasets", repos = "http://dutangc.free.fr/pub/RRepos/", type="source")
#四
install.packages("devtools")
devtools::install_github("dutangc/CASdatasets", subdir="pkg")
都没成功
> install.packages("CASdatasets", repos = "http://cas.uqam.ca/pub/", type="source")
trying URL 'http://cas.uqam.ca/pub/src/contrib/CASdatasets_1.0-11.tar.gz'
Content type 'application/x-gzip' length 119516409 bytes (114.0 MB)
downloaded 148 KB
Warning in install.packages :
downloaded length 152373 != reported length 119516409
Warning in install.packages :
URL 'http://cas.uqam.ca/pub/src/contrib/CASdatasets_1.0-11.tar.gz': Timeout of 60 seconds was reached
Error in download.file(url, destfile, method, mode = "wb", ...) :
download from 'http://cas.uqam.ca/pub/src/contrib/CASdatasets_1.0-11.tar.gz' failed
Warning in install.packages :
下载程序包‘CASdatasets’时出了问题
> install.packages("CASdatasets", repos = "http://dutangc.perso.math.cnrs.fr/RRepository/", type="source")
Warning in install.packages :
无法在貯藏處http://dutangc.perso.math.cnrs.fr/RRepository/src/contrib中读写索引:
cannot open URL 'http://dutangc.perso.math.cnrs.fr/RRepository/src/contrib/PACKAGES'
Warning in install.packages :
package ‘CASdatasets’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
> devtools::install_github("dutangc/CASdatasets", subdir="pkg")
Downloading GitHub repo dutangc/CASdatasets@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet, :
download from 'https://api.github.com/repos/dutangc/CASdatasets/tarball/HEAD' failed
我的r版本是4.2.2,如有人使用上述链接安装成功欢迎评论区指正。