-
-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Renaming factors" section does not reflect true results of running these commands #728
Comments
Hi @rkmeade, thank you for raising this issue. Using the code from the lesson, it runs as expected. See reproducible example below. However, I can replicate your issue by using Correct output, using
|
Hi Maintainers!
A quick comment on the "Renaming factors" section, which does not work on my console the same way the episode says that it should.
Beginning with the first command, plot(surveys$sex), my console plots the ~1700 missing values as their own column (which is not reflected on the plot in the episode). I believe this is because instead of NA, it recognizes a third category of values, designated "".
In the next set of commands:
sex <- surveys$sex
levels(sex)
The lesson says the output should be:
[1] "F" "M"
This is what I get:
[1] "" "F" "M"
In the next code block, a new category for missing values is added:
sex <- addNA(sex)
levels(sex)
The lesson says the output should be:
[1] "F" "M" NA
My output now has two equivalents of missing values:
[1] "" "F" "M" NA
I believe all downstream errors can be remediated by running this before the initial plot command:
levels(sex)[1] <- NA
I hope this is helpful!
-- Rachel
The text was updated successfully, but these errors were encountered: