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

Quo path #132

Merged
merged 5 commits into from
Jan 30, 2021
Merged

Quo path #132

merged 5 commits into from
Jan 30, 2021

Conversation

colearendt
Copy link
Owner

@colearendt colearendt commented Jan 2, 2021

Close #129
Close #130

Both should now be possible - please give this a try and let me know if it works for you. Specifically to use within a function:

library(tidyjson)
#> 
#> Attaching package: 'tidyjson'
#> The following object is masked from 'package:stats':
#> 
#>     filter

enter_fix <- function(tbl_json, object) {
  tbl_json %>%
    enter_object(!!!object) %>%
    gather_array %>%
    spread_all %>%
    as_tibble()
}
enter_fix(worldbank, 'majorsector_percent')
#> # A tibble: 1,405 x 4
#>    document.id array.index Name                                    Percent
#>          <int>       <int> <chr>                                     <dbl>
#>  1           1           1 Education                                    46
#>  2           1           2 Education                                    26
#>  3           1           3 Public Administration, Law, and Justice      16
#>  4           1           4 Education                                    12
#>  5           2           1 Public Administration, Law, and Justice      70
#>  6           2           2 Public Administration, Law, and Justice      30
#>  7           3           1 Transportation                              100
#>  8           4           1 Health and other social services            100
#>  9           5           1 Industry and trade                           50
#> 10           5           2 Industry and trade                           40
#> # … with 1,395 more rows

Created on 2021-01-02 by the reprex package (v0.3.0)

@colearendt colearendt merged commit 6992ab7 into master Jan 30, 2021
@colearendt colearendt deleted the quo-path branch January 30, 2021 13:11
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 this pull request may close these issues.

enter_object won't work inside function Add compatibility with dplyr programming data masking
1 participant