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

Error: Mapping & tidy = FALSE #27

Closed
andrewallenbruce opened this issue Oct 27, 2023 · 2 comments
Closed

Error: Mapping & tidy = FALSE #27

andrewallenbruce opened this issue Oct 27, 2023 · 2 comments
Assignees
Labels
bug 💣 an unexpected problem or unintended behavior
Milestone

Comments

@andrewallenbruce
Copy link
Owner

library(provider)
purrr::map_dfr(util_years(), ~utilization(year = .x, 
                                          city = "Valdosta", 
                                          state = "GA", 
                                          type = "provider", 
                                          tidy = FALSE))
#> Error in `dplyr::bind_rows()`:
#> ! Can't combine `..1$Tot_HCPCS_Cds` <integer> and `..5$Tot_HCPCS_Cds` <character>.
#> Backtrace:
#>      ▆
#>   1. ├─purrr::map_dfr(...)
#>   2. │ └─dplyr::bind_rows(res, .id = .id)
#>   3. │   └─vctrs::vec_rbind(!!!dots, .names_to = .id, .error_call = current_env())
#>   4. └─vctrs (local) `<fn>`()
#>   5.   └─vctrs::vec_default_ptype2(...)
#>   6.     ├─base::withRestarts(...)
#>   7.     │ └─base (local) withOneRestart(expr, restarts[[1L]])
#>   8.     │   └─base (local) doWithOneRestart(return(expr), restart)
#>   9.     └─vctrs::stop_incompatible_type(...)
#>  10.       └─vctrs:::stop_incompatible(...)
#>  11.         └─vctrs:::stop_vctrs(...)
#>  12.           └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call)

Created on 2023-10-27 with reprex v2.0.2

@andrewallenbruce andrewallenbruce added the bug 💣 an unexpected problem or unintended behavior label Oct 27, 2023
@andrewallenbruce andrewallenbruce added this to the 0.0.1 milestone Oct 27, 2023
@andrewallenbruce andrewallenbruce self-assigned this Oct 27, 2023
@andrewallenbruce
Copy link
Owner Author

andrewallenbruce commented Oct 30, 2023

Fix: pipe the response into the below one-liner:

results <- httr2::resp_body_json(response, simplifyVector = TRUE) |>
    dplyr::mutate(dplyr::across(dplyr::everything(), as.character))

Edit: created helper function df2chr():

results <- httr2::resp_body_json(response, simplifyVector = TRUE) |>
    df2chr()

Edit: should be of the form:

results <- httr2::resp_body_json(response, simplifyVector = TRUE)

  if (!tidy) results <- df2chr(results)

  if (tidy) {...}

@andrewallenbruce
Copy link
Owner Author

andrewallenbruce commented Oct 30, 2023

Add to:

  • utilization()
  • quality_payment()
  • open_payments()
  • conditions()

andrewallenbruce added a commit that referenced this issue Oct 30, 2023
andrewallenbruce added a commit that referenced this issue Oct 31, 2023
deprecated functions removed (#28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💣 an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant