“package ‘ElemStatLearn‘ is not available for this version of R

在尝试使用R语言安装ElemStatLearn包时遇到问题,提示该包不在当前R版本的可用列表中。通过手动从CRAN存档下载源代码包并使用install.packages()函数以'source'类型安装解决了问题。然而,加载包时仍然出现错误,因为包可能已从CRAN移除。建议查找替代包或使用旧版本的R进行安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

"package 'ElemStatLearn' is not available for this version of R

问题:

# install.packages('ElemStatLearn')

# "package 'ElemStatLearn' is not available for this version of R

require(e1071)
install.packages('ElemStatLearn')
require(ElemStatLearn)#package containing the dataset

#Loading the data
attach(mixture.example) #is just a simulated mixture data with 200 rows and 2 classes
names(mixture.example)

解决:


install.packages(packageurl, repos=NULL, type="source")

# https://cran.r-project.org/src/contrib/Archive/ElemStatLearn/ElemStatLearn_2015.6.26.tar.gz

packageurl <- "https://cran.r-project.org/src/contrib/Archive/ElemStatLearn/ElemStatLearn_2015.6.26.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

完整错误:

Warning message:
"unable to access index for repository https://CRAN.R-project.org/package=ElemStatLearn/src/contrib:
  无法打开URL'https://CRAN.R-project.org/package=ElemStatLearn/src/contrib/PACKAGES'"
Warning message:
"package 'ElemStatLearn' 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"
Warning message:
"unable to access index for repository https://CRAN.R-project.org/package=ElemStatLearn/bin/windows/contrib/4.1:
  无法打开URL'https://CRAN.R-project.org/package=ElemStatLearn/bin/windows/contrib/4.1/PACKAGES'"
载入需要的程辑包:ElemStatLearn

Warning message in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
"不存在叫'ElemStatLearn'这个名字的程辑包"
Error in attach(mixture.example): 找不到对象'mixture.example'
Traceback:

1. attach(mixture.example)

The package has been removed from CRAN:
CRAN - Package ElemStatLearn (r-project.org)

You can still install an archived version.

参考:Installing "ElemStatLearn" error

参考:R

参考:package ‘ElemStatLearn’ is not available (for R version 4.0.2)

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Data+Science+Insight

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值