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

Missing equivalent transformation in base R example README.md #32

Open
jonathonmellor opened this issue Apr 5, 2022 · 1 comment
Open

Comments

@jonathonmellor
Copy link

The dataset is loan data available in the openintro package. Here is the Tidy code to preprocess the data:

loans <- openintro::loans_full_schema %>%
   mutate(
         homeownership = str_to_title(homeownership),
         bankruptcy = if_else(public_record_bankrupt >= 1, "Yes", "No")
         ) %>%
   filter(annual_income >= 10)

In base-R:

loans <- openintro::loans_full_schema
loans$bankruptcy <- ifelse(loans$public_record_bankrupt >= 1, "Yes", "No")
subset(loans,annual_income >= 10)

The tidyverse example contains a mutate on homeownership which needs a base-R equivalent have (I've used stringr here as in the piece it states stringr is not tidyverse).

loans$homeownership <- str_to_title(homeownership)
@matloff
Copy link
Owner

matloff commented Mar 11, 2023

Again, the Tidy code is from the article written by prominent Tidy advocates.

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