mtcars {datasets} | R 文件 |
資料摘自 1974 年美國《Motor Trend》雜誌,包含了 32 輛汽車(1973-74 款)的燃油消耗以及 10 個方面的汽車設計和效能。
mtcars
一個包含 32 個觀測值和 11 個(數值型)變數的資料框。
[, 1] | mpg | 每加侖(美國)英里數 |
[, 2] | cyl | 氣缸數 |
[, 3] | disp | 排量(立方英寸) |
[, 4] | hp | 總馬力 |
[, 5] | drat | 後橋比 |
[, 6] | wt | 重量(千磅) |
[, 7] | qsec | 1/4 英里加速時間 |
[, 8] | vs | 發動機(0 = V 型,1 = 直列型) |
[, 9] | am | 變速箱(0 = 自動,1 = 手動) |
[,10] | gear | 前進擋數量 |
[,11] | carb | 化油器數量 |
Henderson 和 Velleman (1981) 在第 1 表的腳註中評論道:“Hocking(原始轉錄者)將馬自達的轉子發動機非關鍵地編碼為直列六缸發動機,將保時捷的水平對置發動機編碼為 V 型發動機,幷包含柴油版梅賽德斯 240D,這些都得以保留,以便與之前的分析進行直接比較。”
Henderson and Velleman (1981), Building multiple regression models interactively. Biometrics, 37, 391-411.
require(graphics) pairs(mtcars, main = "mtcars data", gap = 1/4) coplot(mpg ~ disp | as.factor(cyl), data = mtcars, panel = panel.smooth, rows = 1) ## possibly more meaningful, e.g., for summary() or bivariate plots: mtcars2 <- within(mtcars, { vs <- factor(vs, labels = c("V", "S")) am <- factor(am, labels = c("automatic", "manual")) cyl <- ordered(cyl) gear <- ordered(gear) carb <- ordered(carb) }) summary(mtcars2)