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

Episode 4: Data Structures: Exploring Data Frames - rbind and factors #107

Open
cengel opened this issue May 30, 2021 · 0 comments · May be fixed by #152
Open

Episode 4: Data Structures: Exploring Data Frames - rbind and factors #107

cengel opened this issue May 30, 2021 · 0 comments · May be fixed by #152

Comments

@cengel
Copy link
Contributor

cengel commented May 30, 2021

R is not giving a warning when executing rbind(gapminder, new_row). gapminder$continent is not a factor.

To understand why R is giving us a warning when we try to add this row, let's learn a little more about factors.

It does, however, for the same reason, generate a warning message after running this:
levels(gapminder$continent) <- c(levels(gapminder$continent), "Nordic")
gapminder_norway <- rbind(gapminder, list('Norway', 2016, 5000000, 'Nordic', 80.3,49400.0, FALSE))

And the fix suggested gapminder$continent <- as.character(gapminder$continent) also needs to be adjusted.

@cengel cengel changed the title Episode 4: Data Structures: Exploring Data Frames - no warning with rbind Episode 4: Data Structures: Exploring Data Frames - rbind and factors May 30, 2021
@albhasan albhasan linked a pull request Jan 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant