swirldev / swirl_courses

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

Cars data in Exploratory_Data_Analysis / Plotting Systems #237

Closed piercecole closed 7 years ago

piercecole commented 8 years ago

Data for Cars appears incorrect for Plotting of Speed and Dist.

| We'll use the R command with which takes two arguments. The first specifies a dataset or | environment in which to run the second argument, an R expression. This will save us a bit | of typing. Try running the command with now using cars as the first argument and a call to | plot as the second. The call to plot will take two arguments, speed and dist. Please | specify them in that order.

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

| Nice try, but that's not exactly what I was hoping for. Try again. Or, type info() for | more options.

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

seankross commented 8 years ago

Can you clarify the issue you're having?

brandonparsons commented 8 years ago

The command it is looking for doesn't work with the environment/data swirl is providing here.

> with(cars, plot(speed, dist))
Error in plot(speed, dist) : object 'speed' not found
seankross commented 8 years ago

cars is a dataset that is built in to R. What do you get as the result of exists("cars")?

jbuck84 commented 7 years ago

I am seeing this same issue as well - speed nor dist appear to exist in dataset = cars.

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 7 large 23.7 16 rear 6 4105 8 midsize 26.3 19 front 5 3495 9 large 34.7 16 front 6 3620 10 midsize 40.1 16 front 5 3935 11 midsize 15.9 21 front 6 3195 12 large 18.8 17 rear 6 3910 13 large 18.4 20 front 6 3515 14 large 29.5 20 front 6 3570 15 small 9.2 29 front 5 2270 16 small 11.3 23 front 5 2670 17 midsize 15.6 21 front 6 3080 18 small 12.2 29 front 5 2295 19 large 19.3 20 front 6 3490 20 small 7.4 31 front 4 1845 21 small 10.1 23 front 5 2530 22 midsize 20.2 21 front 5 3325 23 large 20.9 18 rear 6 3950 24 small 8.4 46 front 4 1695 25 small 12.1 42 front 4 2350 26 small 8.0 29 front 5 2345 27 small 10.0 22 front 5 2620 28 midsize 13.9 20 front 5 2885 29 midsize 47.9 17 rear 5 4000 30 midsize 28.0 18 front 5 3510 31 midsize 35.2 18 rear 4 3515 32 midsize 34.3 17 front 6 3695 33 large 36.1 18 rear 6 4055 34 small 8.3 29 front 4 2325 35 small 11.6 28 front 5 2440 36 midsize 61.9 19 rear 5 3525 37 midsize 14.9 19 rear 5 3610 38 small 10.3 29 front 5 2295 39 midsize 26.1 18 front 5 3730 40 small 11.8 29 front 5 2545 41 midsize 21.5 21 front 5 3200 42 midsize 16.3 23 front 5 2890 43 large 20.7 19 front 6 3470 44 small 9.0 31 front 4 2350 45 midsize 18.5 19 front 5 3450 46 large 24.4 19 front 6 3495 47 small 11.1 28 front 5 2495 48 small 8.4 33 4WD 4 2045 49 small 10.9 25 4WD 5 2490 50 small 8.6 39 front 4 1965 51 small 9.8 32 front 5 2055 52 midsize 18.2 22 front 5 3030 53 small 9.1 25 front 4 2240 54 midsize 26.7 20 front 5 3245

| Not quite! Try again. Or, type info() for more options.

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

with(cars, plot(speed, dist)) Error in plot(speed, dist) : object 'speed' not found exists("cars") [1] TRUE

| That's not the answer I was looking for, but try again. Or, type info() for more options.

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

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

*Also, when I try to skip the question with the skip() command, it kicks me out of swirl instead of skipping the question:

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

info()

| When you are at the R prompt (>): | -- Typing skip() allows you to skip the current question. | -- Typing play() lets you experiment with R on your own; swirl will ignore what you do... | -- UNTIL you type nxt() which will regain swirl's attention. | -- Typing bye() causes swirl to exit. Your progress will be saved. | -- Typing main() returns you to swirl's main menu. | -- Typing info() displays these options again.

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

| Leaving swirl now. Type swirl() to resume.

jbuck84 commented 7 years ago

Reloading swirl and the exploratory data analysis package fixed the issue for me. Not sure what happened, but dataset=cars looks as expeceted now (includes speed and dist).

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