Learn R Programming

openintro (version 2.4.0)

cars93: cars93

Description

A data frame with 54 rows and 6 columns. This data is a subset of the Cars93 data set from the MASS package.

Usage

cars93

Arguments

Format

A data frame with 54 observations on the following 6 variables.

type

The vehicle type with levels large, midsize, and small.

price

Vehicle price (USD).

mpg_city

Vehicle mileage in city (miles per gallon).

drive_train

Vehicle drive train with levels 4WD, front, and rear.

passengers

The vehicle passenger capacity.

weight

Vehicle weight (lbs).

Details

These cars represent a random sample for 1993 models that were in both Consumer Reports and PACE Buying Guide. Only vehicles of type small, midsize, and large were include.

Further description can be found in Lock (1993). Use the URL http://jse.amstat.org/v1n1/datasets.lock.html.

Examples

Run this code

library(ggplot2)

# Vehicle price by type
ggplot(cars93, aes(x = price)) +
  geom_histogram(binwidth = 5) +
  facet_wrap(~type)

# Vehicle price vs. weight
ggplot(cars93, aes(x = weight, y = price)) +
  geom_point()

# Milleage vs. weight
ggplot(cars93, aes(x = weight, y = mpg_city)) +
  geom_point() +
  geom_smooth()

Run the code above in your browser using DataLab