Skip to content
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

Levels for factors not clear #30

Open
bakera81 opened this issue Apr 1, 2017 · 1 comment
Open

Levels for factors not clear #30

bakera81 opened this issue Apr 1, 2017 · 1 comment

Comments

@bakera81
Copy link

bakera81 commented Apr 1, 2017

https://campus.datacamp.com/courses/free-introduction-to-r/chapter-4-factors-4?ex=6

We assign "Female" first when setting the levels:
levels(factor_survey_vector) <- c("Female", "Male")
but "male" is the first factor:
male <- factor_survey_vector[1]

This is because the first element of survey_vector is "M" Could this behavior be made clearer somehow?

@ramnathv
Copy link

It would be better to make this explicit by using

levels(x) <- c(F = "Female", M = "Male")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants