ncarchedi / swirl_OLD

We've moved! See README below for more info.
http://swirlstats.com
47 stars 28 forks source link

Computing median of 'myDrive' variable upon resuming progress #17

Closed ncarchedi closed 10 years ago

ncarchedi commented 10 years ago

I'm submitted this issue on behalf of Petros, who emailed me directly:

"Hi,

See the attached screen shot

EMAIL: *****

Welcome back, Petros! It's great to see you again. Would you like to begin where you left off?

ANSWER: y

I'm displaying the previous plot in case you need to refer back to it.

Second, find the median value of your 'myDrive' variable now.

ANSWER: median(myDrive)

Not a valid input!

An error was detected. Please notify the administator."

WilCrofter commented 10 years ago

The problem is that myDrive is a factor, and while mean(myDrive) returns NA, median(myDrive) throws an error.

Also, try to compute the mean value for the 'myDrive' variable now.

ANSWER: mean(myDrive) [1] NA

You're the best!

.... (some more questions)

Second, find the median value of your 'myDrive' variable now.

ANSWER: median(myDrive)

An error was detected. Please notify the administator.

From the R shell prompt, immediately after the error:

> median(myDrive) Error in median.default(myDrive) : need numeric data

> class(myDrive) [1] "factor"

> head(myDrive) [1] front front front rear front front Levels: 4WD front rear

The question is marked optional: > t(mod[31, 1:3]) 31 Output.Type "question" Output "Second, find the median value of your 'myDrive' variable now." Status "optional"

hence was probably skipped most of the time before Nick's commit which eliminated the mandatory/optional distinction.

Perhaps both the mean(myDrive) and median(myDrive) should be dropped since neither makes sense for a factor. Question 36 asks for the mode, "This time look at your table for your 'myDrive' variable. What is the mode of your 'myDrive' variable?", but the Correct.Answer is given as "43", which is incorrect since, according to the Hint, "Keep in mind that the mode is the value of the variable that is most common, NOT the number of times which it appears." The correct answer would be "front".

> table(myDrive) myDrive 4WD front rear 2 43 9

We (reginaastri & I) could try to make the appropriate changes in mod and push a branch with patched Module1.rda to one of our github accounts. That would not change the original course spreadsheets from which the module was generated, however, so we'll wait for advice on that score.

WilCrofter commented 10 years ago

Made changes to Data_Analysis/Module1.rda as outlined above and saved changed data.frame (mod) to a spreadsheet in csv format. Emailed the result to Nick.

ncarchedi commented 10 years ago

This issue has been resolved. There was an experimental feature that I removed because it was causing this and several other bugs. This question will no longer appear in the module.