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
This is really esoteric but caused a test of mine to fail in a very puzzling way. Dates created by readr are different from those created all other ways (integer vs double).
readr
library(readr) xbase <- data.frame(d = as.Date(c("2016-02-02", NA))) xdplyr <- dplyr::data_frame(d = as.Date(c("2016-02-02", NA))) xreadr <- read_csv("d\n2016-02-02\nNA")
These appear to be the same, up to tbl_df-ness.
tbl_df
str(xbase) #> 'data.frame': 2 obs. of 1 variable: #> $ d: Date, format: "2016-02-02" NA str(xdplyr) #> Classes 'tbl_df', 'tbl' and 'data.frame': 2 obs. of 1 variable: #> $ d: Date, format: "2016-02-02" NA str(xreadr) #> Classes 'tbl_df', 'tbl' and 'data.frame': 2 obs. of 1 variable: #> $ d: Date, format: "2016-02-02" NA
But the readr product stores its dates as integer vs numeric for the other two.
dput(xbase[2, , drop = FALSE]) #> structure(list(d = structure(NA_real_, class = "Date")), .Names = "d", row.names = 2L, class = "data.frame") dput(xdplyr[2, ]) #> structure(list(d = structure(NA_real_, class = "Date")), .Names = "d", class = c("tbl_df", #> "data.frame"), row.names = c(NA, -1L)) dput(xreadr[2, ]) #> structure(list(d = structure(NA_integer_, class = "Date")), .Names = "d", class = c("tbl_df", #> "data.frame"), row.names = c(NA, -1L))
And it means even testthat::expect_equivalent() fails.
testthat::expect_equivalent()
testthat::expect_equivalent(xdplyr, xreadr) #> Error: xdplyr not equal to expected #> Rows in x but not y: 2. Rows in y but not x: 2.
The text was updated successfully, but these errors were encountered:
jimhester
Successfully merging a pull request may close this issue.
This is really esoteric but caused a test of mine to fail in a very puzzling way. Dates created by
readr
are different from those created all other ways (integer vs double).These appear to be the same, up to
tbl_df
-ness.But the
readr
product stores its dates as integer vs numeric for the other two.And it means even
testthat::expect_equivalent()
fails.The text was updated successfully, but these errors were encountered: