Closed john-b-edwards closed 1 year ago
Culprit seems to be the ifelse() used in %c%. could replace with vec_assign() + vec_detect_missing()? https://vctrs.r-lib.org/reference/vec_slice.html
Indeed an ifelse problem with both lubridate dates and base dates. Going to fix now with data.table
library(nflreadr)
`%c%` <- nflreadr:::`%c%`
d1 <- lubridate::as_date(c("1998-05-01",
"1997-12-12",
NA_character_))
d2 <- lubridate::as_date(c("1995-01-31",
NA_character_,
"1997-12-12"))
d1 %c% d2
#> [1] 10347 10207 10207
d3 <- as.Date(c("1998-05-01",
"1997-12-12",
NA_character_))
d4 <- as.Date(c("1995-01-31",
NA_character_,
"1997-12-12"))
d3 %c% d4
#> [1] 10347 10207 10207
Created on 2023-09-05 with reprex v2.0.2
Is there an existing issue for this?
Have you installed the latest development version of the package(s) in question?
What version of the package do you have?
1.3.2.11
Describe the bug
The internal function
nflreadr:::join_coalesce()
converts date objects to integers when joining.Reprex
Expected Behavior
The object returned by
nflreadr:::join_coalesce()
should instead look like:nflverse_sitrep
Screenshots
No response
Additional context
No response