Description Usage Format Details Source References Examples
A data frame with 54 rows and 6 columns. The columns represent the variables type
, price
, mpgCity
, driveTrain
, passengers
, weight
for a sample of 54 cars from 1993. This data is a subset of the Cars93
data set from the MASS
package.
1 |
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).
mpgCity
Vehicle mileage in city (miles per gallon).
driveTrain
Vehicle drive train with levels 4WD
, front
, and rear
.
passengers
The vehicle passenger capacity.
weight
Vehicle weight (lbs).
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://www.amstat.org/publications/jse/v1n1/datasets.lock.html.
Lock, R. H. (1993) 1993 New Car Data. Journal of Statistics Education 1(1).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | data(cars)
#===> vehicle price by type <===#
par(mfrow=c(1,1))
histPlot(cars$price[cars$type=='small'], probability=TRUE,
hollow=TRUE, xlim=c(0,50))
histPlot(cars$price[cars$type=='midsize'], probability=TRUE,
hollow=TRUE, add=TRUE, border='red', lty=3)
histPlot(cars$price[cars$type=='large'], probability=TRUE,
hollow=TRUE, add=TRUE, border='blue', lty=4)
legend('topright', lty=2:4, col=c('black', 'red', 'blue'),
legend=c('small', 'midsize', 'large'))
#===> vehicle price versus weight <===#
plot(cars$weight, cars$price, col=fadeColor('magenta', '88'),
pch=20, cex=2)
#===> mileage versus weight <===#
plot(cars$weight, cars$mpgCity, type="n")
temp <- c(seq(1000, 5000, 100), rev(seq(1000, 5000, 100)), 1000)
hold <- 87.11 - 0.03508*temp + 0.000004432*temp^2 + 7*c(rep(-1, 41), rep(1, 41), 1)
polygon(temp, hold, col="#E2E2E2",
border=fadeColor('black', '00'))
points(cars$weight, cars$mpgCity,
col='chocolate4', pch=20, cex=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.