{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/dplyr/issues/1204","labels_url":"https://api.github.com/repos/hadley/dplyr/issues/1204/labels{/name}","comments_url":"https://api.github.com/repos/hadley/dplyr/issues/1204/comments","events_url":"https://api.github.com/repos/hadley/dplyr/issues/1204/events","html_url":"https://github.com/hadley/dplyr/issues/1204","id":85952049,"number":1204,"title":"all.equal.tbl_df should return TRUE for tbl_df with Date column","user":{"login":"jullybobble","id":1866891,"avatar_url":"https://avatars.githubusercontent.com/u/1866891?v=3","gravatar_id":"","url":"https://api.github.com/users/jullybobble","html_url":"https://github.com/jullybobble","followers_url":"https://api.github.com/users/jullybobble/followers","following_url":"https://api.github.com/users/jullybobble/following{/other_user}","gists_url":"https://api.github.com/users/jullybobble/gists{/gist_id}","starred_url":"https://api.github.com/users/jullybobble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jullybobble/subscriptions","organizations_url":"https://api.github.com/users/jullybobble/orgs","repos_url":"https://api.github.com/users/jullybobble/repos","events_url":"https://api.github.com/users/jullybobble/events{/privacy}","received_events_url":"https://api.github.com/users/jullybobble/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-07T21:58:23Z","updated_at":"2015-08-12T11:23:10Z","closed_at":null,"body":"`a` is a data.frame with a Date column. \r\n```r\r\na <- data.frame(date = as.Date(\"2015-06-07\"))\r\n```\r\nWhen 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`:\r\n\r\n```r\r\nb_tbl <- readr::read_csv(readr::write_csv(a, path = \"\"))\r\nb <- dplyr:::as.data.frame.tbl_df(b_tbl)\r\na_tbl <- dplyr:::as.tbl(a)\r\n\r\ndplyr:::all.equal.tbl_df(a_tbl, b_tbl)\r\n# \"Incompatible type for column date: x Date, y Date\"\r\n\r\nbase:::all.equal.default(a_tbl, b_tbl) \r\n# TRUE\r\n\r\nbase:::all.equal.default(a, b)\r\n # TRUE\r\n\r\ndplyr:::all.equal.tbl_df(a, b)\r\n# \"Incompatible type for column date: x Date, y Date\"\r\n```\r\n\r\nI would expect all 4 `all.equal` statements above to return `TRUE`.\r\n\r\nNote 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`:\r\n```r\r\ndplyr:::all.equal.tbl_df(a_tbl, a)\r\n# TRUE\r\n```"},"comment":{"url":"https://api.github.com/repos/hadley/dplyr/issues/comments/130264692","html_url":"https://github.com/hadley/dplyr/issues/1204#issuecomment-130264692","issue_url":"https://api.github.com/repos/hadley/dplyr/issues/1204","id":130264692,"user":{"login":"romainfrancois","id":2625526,"avatar_url":"https://avatars.githubusercontent.com/u/2625526?v=3","gravatar_id":"","url":"https://api.github.com/users/romainfrancois","html_url":"https://github.com/romainfrancois","followers_url":"https://api.github.com/users/romainfrancois/followers","following_url":"https://api.github.com/users/romainfrancois/following{/other_user}","gists_url":"https://api.github.com/users/romainfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/romainfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romainfrancois/subscriptions","organizations_url":"https://api.github.com/users/romainfrancois/orgs","repos_url":"https://api.github.com/users/romainfrancois/repos","events_url":"https://api.github.com/users/romainfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/romainfrancois/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T11:23:10Z","updated_at":"2015-08-12T11:23:10Z","body":"Hmm. The issue is that for some reason the `Date` in `a` is encoded as a `numeric` instead of an `integer` : \r\n\r\n```\r\n> .Internal(inspect(( a_tbl$date )))\r\n@7f87e3e990c8 14 REALSXP g0c1 [OBJ,MARK,NAM(2),ATT] (len=1, tl=0) 16593\r\nATTRIB:\r\n  @7f87e3a3db48 02 LISTSXP g0c0 [MARK]\r\n    TAG: @7f87f2006148 01 SYMSXP g1c0 [MARK,NAM(2),LCK,gp=0x4000] \"class\" (has value)\r\n    @7f87e3e99098 16 STRSXP g0c1 [MARK,NAM(2)] (len=1, tl=0)\r\n      @7f87f21f18a8 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] \"Date\"\r\n> .Internal(inspect(( b_tbl$date )))\r\n@7f87f6e20cb8 13 INTSXP g0c1 [OBJ,NAM(2),ATT] (len=1, tl=0) 16593\r\nATTRIB:\r\n  @7f87f3b181f8 02 LISTSXP g0c0 []\r\n    TAG: @7f87f2006148 01 SYMSXP g1c0 [MARK,NAM(2),LCK,gp=0x4000] \"class\" (has value)\r\n    @7f87f6e20d18 16 STRSXP g0c1 [NAM(2)] (len=1, tl=0)\r\n      @7f87f21f18a8 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] \"Date\"\r\n```"}}