R语言数据包自带数据集之mtcars数据集字段解释数据导入实战
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R语言数据包自带数据集之mtcars数据集字段解释数据导入实战相关的知识,希望对你有一定的参考价值。
R语言数据包自带数据集之mtcars数据集字段解释、数据导入实战
目录
R语言数据包自带数据集之mtcars数据集字段解释、数据导入实战
#会用帮助?或者help函数
内置的mtcars数据框包含有关32辆汽车的信息,包括它们的重量,燃油效率(以每加仑英里为单位),速度等。
要了解有关数据集的更多信息,请使用help(mtcars)。
#字段说明
数据来自1974年美国汽车趋势杂志,包括32辆汽车(1973-74款)的油耗和10个方面的汽车设计和性能。
format
A data frame with 32 observations on 11 (numeric) variables.
[, 1] | mpg | Miles/(US) gallon :每加仑油能跑多少英里 |
[, 2] | cyl | Number of cylinders:气缸的个数 |
[, 3] | disp | Displacement (cu.in.):车的排量 |
[, 4] | hp | Gross horsepower:总马力 |
[, 5] | drat | Rear axle ratio:后轴比 |
[, 6] | wt | Weight (1000 lbs):重量 |
[, 7] | qsec | 1/4 mile time:衡量启动加速能力 |
[, 8] | vs | Engine (0 = V-shaped, 1 = straight):引擎类型 |
[, 9] | am | Transmission (0 = automatic, 1 = manual):传动方式,自动变速还是手动变速 |
[,10] | gear | Number of forward gears:前进齿轮数 |
[,11] | carb | Number of carburetors:化油器个数 |
#导入包
# 导入R内自带的ToothGrowth数据集
library(datasets)
data(mtcars)
#导入数据
str(mtcars)
head(mtcars)
Format
A data frame with 32 observations on 11 (numeric) variables.
[, 1] | mpg | Miles/(US) gallon |
[, 2] | cyl | Number of cylinders |
[, 3] | disp | Displacement (cu.in.) |
[, 4] | hp | Gross horsepower |
[, 5] | drat | Rear axle ratio |
[, 6] | wt | Weight (1000 lbs) |
[, 7] | qsec | 1/4 mile time |
[, 8] | vs | Engine (0 = V-shaped, 1 = straight) |
[, 9] | am | Transmission (0 = automatic, 1 = manual) |
[,10] | gear | Number of forward gears |
[,11] | carb | Number of carburetors |
Note
Henderson and Velleman (1981) comment in a footnote to Table 1: ‘Hocking [original transcriber]'s noncrucial coding of the Mazda's rotary engine as a straight six-cylinder engine and the Porsche's flat engine as a V engine, as well as the inclusion of the diesel Mercedes 240D, have been retained to enable direct comparisons to be made with previous analyses.’
参考:R
参考:基础-R内置数据集
参考:[R语言]dataset数据包信息汇总
以上是关于R语言数据包自带数据集之mtcars数据集字段解释数据导入实战的主要内容,如果未能解决你的问题,请参考以下文章
R语言数据包自带数据集之survival包的lung数据集字段解释数据导入实战
R语言数据包自带数据集之ISwR包的melanom数据集字段解释数据导入实战
R语言数据包自带数据集之ISwR包的melanom数据集字段解释数据导入实战