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 when using lubridate arithmetic in if_else loop #1922

Closed
chris-nunn opened this issue Apr 4, 2024 · 1 comment
Closed

Error when using lubridate arithmetic in if_else loop #1922

chris-nunn opened this issue Apr 4, 2024 · 1 comment

Comments

@chris-nunn
Copy link

Error in mutate():
i In argument: start = if_else(month == "dec", start - years(1), start).
Caused by error in vec_ptype_common():
! Column second (size 432) must match the data frame (size 1).
i In file slice.c at line 191.
i Install the winch package to get additional debugging info the next time you get this error.
i This is an internal error that was detected in the vctrs package.
Please report it at https://github.com/r-lib/vctrs/issues with a reprex and the full backtrace.

This is the backtrace:

x

  1. +-... %>% ...
  2. +-dplyr::mutate(...)
  3. +-tidyr::pivot_longer(., future_suitability:historical)
  4. +-dplyr::rename(., future_suitability = value)
  5. +-dplyr::mutate(...)
  6. +-dplyr:::mutate.data.frame(., start = if_else(month == "dec", start - years(1), start))
  7. | -dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  8. | +-base::withCallingHandlers(...)
  9. | -dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
  10. | -mask$eval_all_mutate(quo)
  11. | -dplyr (local) eval()
  12. +-dplyr::if_else(month == "dec", start - years(1), start)
  13. | -dplyr:::vec_case_when(...)
  14. | -vctrs::vec_ptype_common(!!!everything, .ptype = ptype, .call = call)
  15. -rlang:::stop_internal_c_lib(...)
  16. -rlang::abort(message, call = call, .internal = TRUE, .frame = frame)`
@chris-nunn
Copy link
Author

start, the variable being acted on, was not a date

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

1 participant