Skip to content

Look into parsnip::fit() conflict with new_epi_df()? #111

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

Closed
rachlobay opened this issue Jul 26, 2022 · 1 comment
Closed

Look into parsnip::fit() conflict with new_epi_df()? #111

rachlobay opened this issue Jul 26, 2022 · 1 comment
Labels
P2 low priority

Comments

@rachlobay
Copy link
Contributor

rachlobay commented Jul 26, 2022

Look into what in parsnip::fit() conflicts with new_epi_df(). This problem should be apparent when new_epi_df() is used instead of as_epi_df() in [.epi_df from epiprocess and likely has to do with the couple of lines of column reordering code in new_epi_df(). This is related to Issue #104, but is lower priority as it is not likely to cause issues at present, but may be a problem for us in the future.

Example:

library(dplyr)
library(recipes)
library(parsnip)

jhu <- case_death_rate_subset %>%
  filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))

r <- epi_recipe(jhu) %>%
  step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
  step_epi_ahead(death_rate, ahead = 7) %>%
  step_naomit(all_predictors()) %>%
  step_naomit(all_outcomes(), skip = TRUE)

wf <- epi_workflow(r, linear_reg()) %>% parsnip::fit(jhu) 

Resulting error:

Error in `dplyr::mutate()`:
! Problem while computing `time_value = time_value + shift_val`.
Caused by error in `time_value + shift_val`:
! non-numeric argument to binary operator
@rachlobay rachlobay added the P2 low priority label Jul 26, 2022
@dajmcdon
Copy link
Contributor

dajmcdon commented Aug 1, 2022

Reposting from #104

I messed around with this a bit yesterday. The (first?) specific issue (using the example in my check) is:

  1. In epi_shift_single(), line 35 in my code: dplyr::select(tidyselect::all_of(c(key_cols, col))).
  2. The result of this line switches the NAMES time_value and geo_value for some reason. The result being that time_value then contains data with states while geo_value contains the dates.
  3. Trying to add an integer shift_val to the character bombs.

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

No branches or pull requests

2 participants