swirldev / swirl_courses

:mortar_board: A collection of interactive courses for the swirl R package.
http://swirlstats.com
Other
4.25k stars 7.25k forks source link

Exploratory Data Analysis - Plotting Systems - cars #371

Open dibyanta opened 6 years ago

dibyanta commented 6 years ago

I seem to have a different 'cars' dataset loaded than what the question intended, as the variables speed and dist do not seem to exist in the loaded dataset:

head(cars) type price mpgCity driveTrain passengers weight 1 small 15.9 25 front 5 2705 2 midsize 33.9 18 front 5 3560 3 midsize 37.7 19 front 6 3405 4 midsize 30.0 22 rear 4 3640 5 midsize 15.7 22 front 6 2880 6 large 20.8 19 front 6 3470

| Type with(cars, plot(speed, dist)) at the command prompt.

with(cars, plot(speed, dist)) Error in plot(speed, dist) : object 'speed' not found

erictleung commented 6 years ago

@dibyanta you probably have another package loaded that has its own cars dataset. I believe the dataset this is intending you to have is the one from the datasets package, which you can forcibly access using

> head(datasets::cars)
  speed dist
1     4    2
2     4   10
3     7    4
4     7   22
5     8   16
6     9   10