R语言数据包自带数据集之mtcars数据集字段解释、数据导入实战

目录

R语言数据包自带数据集之mtcars数据集字段解释、数据导入实战

#会用帮助?或者help函数

#字段说明

#导入包

#导入数据

Format

Note


#会用帮助?或者help函数

内置的mtcars数据框包含有关32辆汽车的信息,包括它们的重量,燃油效率(以每加仑英里为单位),速度等。

要了解有关数据集的更多信息,请使用help(mtcars)。

#字段说明

数据来自1974年美国汽车趋势杂志,包括32辆汽车(1973-74款)的油耗和10个方面的汽车设计和性能。

format

A data frame with 32 observations on 11 (numeric) variables.

[, 1]mpgMiles/(US) gallon :每加仑油能跑多少英里
[, 2]cylNumber of cylinders:气缸的个数
[, 3]dispDisplacement (cu.in.):车的排量
[, 4]hpGross horsepower:总马力
[, 5]dratRear axle ratio:后轴比
[, 6]wtWeight (1000 lbs):重量
[, 7]qsec1/4 mile time:衡量启动加速能力
[, 8]vsEngine (0 = V-shaped, 1 = straight):引擎类型
[, 9]amTransmission (0 = automatic, 1 = manual):传动方式,自动变速还是手动变速
[,10]gearNumber of forward gears:前进齿轮数
[,11]carbNumber of carburetors:化油器个数

#导入包

# 导入R内自带的ToothGrowth数据集
library(datasets)
data(mtcars)

#导入数据

str(mtcars)
head(mtcars)


Format

A data frame with 32 observations on 11 (numeric) variables.

[, 1]mpgMiles/(US) gallon
[, 2]cylNumber of cylinders
[, 3]dispDisplacement (cu.in.)
[, 4]hpGross horsepower
[, 5]dratRear axle ratio
[, 6]wtWeight (1000 lbs)
[, 7]qsec1/4 mile time
[, 8]vsEngine (0 = V-shaped, 1 = straight)
[, 9]amTransmission (0 = automatic, 1 = manual)
[,10]gearNumber of forward gears
[,11]carbNumber 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数据包信息汇总

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐