无法访问Caret中的汽车数据集
我正在通过书[应用预测建模] http://appliedpredictictivemodeling.com
说,
为了说明代码,我们将在Caret软件包中使用CARS数据集的子集。 2005年,收集了804克汽车的凯利蓝书转售数据(Kuiper 2008)。该模型的目的是根据已知特征来预测汽车的价格。该演示将重点介绍一部分车辆的价格,里程和汽车类型(例如轿车):
但是,我无法访问数据集。看来 Caret 软件包中没有2005年的汽车数据集。这是我正在使用的代码:
library(AppliedPredictiveModeling)
library(caret)
cars
这是从R数据集包返回CARS数据集,而不是2005年的Applied预测建模数据集。
接下来我尝试:
AppliedPredictiveModeling::cars
这将返回错误:“错误:'CARS'不是从“命名空间:AppliedPredictiveModeling”中导出的对象“
以类似的方式,代码:
caret::cars
返回错误:“错误:'cars'不是从'namespace:caret'的导出对象:
作者的GitHub Solutions页面。本章的任何内容:用于应用的预测建模的github解决方案
同一数据集似乎在中似乎在中modeldata package,但这似乎也不起作用,这也不是:
library(modeldata)
modeldata::car_prices
返回错误:“错误:'car_prices'不是从'namespace:modeldata'“
以类似方式导出的对象”:
car_prices
返回错误:object'car_prices'car_prices “没有发现
我正在使用以下内容,并随后最新(MacOS,R,Rstudio,软件包):
R版本4.2.0(2022-04-22) - “剧烈的健美操” 版权(C)2022 R统计计算基础 平台:AARCH64-APPLE-DARWIN20(64位)
2005 Kelly Blue Book Resale数据集的804 GM汽车的数据集如何访问?
I'm working through the book [Applied Predictive Modeling] http://appliedpredictivemodeling.com
Starting on page 56, the instructions say,
To illustrate the code, we will take a subset of the cars data set in the caret package. For 2005, Kelly Blue Book resale data for 804 GM cars were collected (Kuiper 2008). The object of the model was to predict the price of the car based on known characteristics. This demonstration will focus on the price, mileage, and car type (e.g., sedan) for a subset of vehicles:
However, I'm not able to access the data set. It appears there is no 2005 cars data set in the caret package. Here is the code I'm using:
library(AppliedPredictiveModeling)
library(caret)
cars
This returns a cars data set from the R datasets package, not the Applied Predictive Modeling data set of cars from 2005.
Next I tried:
AppliedPredictiveModeling::cars
This returns an error: "Error: 'cars' is not an exported object from 'namespace:AppliedPredictiveModeling'"
In a similar manner, the code:
caret::cars
returns the error: "Error: 'cars' is not an exported object from 'namespace:caret'"
The Github solutions page by the authors does not have anything for this chapter: Github solutions for Applied Predictive Modeling
The same dataset appears to be in the modeldata package, but this appears not to work, either:
library(modeldata)
modeldata::car_prices
returns an error: "Error: 'car_prices' is not an exported object from 'namespace:modeldata'"
In a similar manner:
car_prices
return an error: object 'car_prices' not found
I'm using the following, with the following up to date (MacOS, R, RStudio, packages):
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
How is the data set of 2005 Kelly Blue Book resale data for 804 GM cars accessed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个默认的
cars
数据集。您需要过度阴影。data
函数应加载数据集到工作区中:此功能的存在以及
df
函数的存在就是为什么“数据”也不应该用作数据对象的名称。 R解析器能够直接从句法上下文中保持直接,但是错误消息在出现时会令人困惑。人类可能会感到困惑阅读代码。There is a default
cars
dataset. You need to over-shadow it. Thedata
function should load the dataset into the workspace:The existence of this function as well as the existence of the
df
function are why neither "data" nor "df" should be used as names for data objects. The R parser is able to keep then straight from syntactic context, but the error messages are rather confusing when they arise. And humans may be confused reading the code.