a is a data.frame with a Date column.
a <- data.frame(date = as.Date("2015-06-07"))
When serialised and deserialised with readr's write_csv and read_csv, the resulting data.frame b_tbl is equal to a according to base:::all.equal.default, but not according to dplyr:::all.equal.tbl_df:
b_tbl <- readr::read_csv(readr::write_csv(a, path = "")) b <- dplyr:::as.data.frame.tbl_df(b_tbl) a_tbl <- dplyr:::as.tbl(a) dplyr:::all.equal.tbl_df(a_tbl, b_tbl) # "Incompatible type for column date: x Date, y Date" base:::all.equal.default(a_tbl, b_tbl) # TRUE base:::all.equal.default(a, b) # TRUE dplyr:::all.equal.tbl_df(a, b) # "Incompatible type for column date: x Date, y Date"
I would expect all 4 all.equal statements above to return TRUE.
Note that this occurs only if b_tbl is the result of a write_csv and read_csv, so I am not sure whether the issue is related to readr or dplyr, but the inconsistency shows in dplyr:
dplyr:::all.equal.tbl_df(a_tbl, a) # TRUE