{"action":"closed","issue":{"url":"https://api.github.com/repos/hadley/testthat/issues/526","repository_url":"https://api.github.com/repos/hadley/testthat","labels_url":"https://api.github.com/repos/hadley/testthat/issues/526/labels{/name}","comments_url":"https://api.github.com/repos/hadley/testthat/issues/526/comments","events_url":"https://api.github.com/repos/hadley/testthat/issues/526/events","html_url":"https://github.com/hadley/testthat/issues/526","id":176825473,"number":526,"title":"Option to print out the contents in dataframes when they are different in expect_* APIs","user":{"login":"HyukjinKwon","id":6477701,"avatar_url":"https://avatars.githubusercontent.com/u/6477701?v=3","gravatar_id":"","url":"https://api.github.com/users/HyukjinKwon","html_url":"https://github.com/HyukjinKwon","followers_url":"https://api.github.com/users/HyukjinKwon/followers","following_url":"https://api.github.com/users/HyukjinKwon/following{/other_user}","gists_url":"https://api.github.com/users/HyukjinKwon/gists{/gist_id}","starred_url":"https://api.github.com/users/HyukjinKwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyukjinKwon/subscriptions","organizations_url":"https://api.github.com/users/HyukjinKwon/orgs","repos_url":"https://api.github.com/users/HyukjinKwon/repos","events_url":"https://api.github.com/users/HyukjinKwon/events{/privacy}","received_events_url":"https://api.github.com/users/HyukjinKwon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-14T06:26:39Z","updated_at":"2016-12-15T03:54:31Z","closed_at":"2016-12-15T03:54:31Z","body":"I took a look for the documentation, https://cran.r-project.org/web/packages/testthat/testthat.pdf and looked though StackOverFlow.\n\nIt seems there is no way to directly print out the dataframes when it fails to the comparison.\n\nFor example,\n\n``` r\ndf <- data.frame(matrix(rnorm(10), nrow=5))\ndf1 <- data.frame(matrix(rnorm(10), nrow=5))\nexpect_equal(df, df1)\n```\n\nprints only some information about differences\n\n``` r\nError: `df` not equal to `df1`.\nComponent “X1”: Mean relative difference: 1.281164\nComponent “X2”: Mean relative difference: 0.987835\n```\n\nIt sometimes makes the debugging hard when the names are different as below:\n\n``` r\n> df <- data.frame(a=c(1,1,1),b=c(2,2,2))\n> df1 <- data.frame(b=c(1,1,1),b=c(2,2,2))\n> expect_equal(df, df1)\n```\n\nprints\n\n``` r\nError: `df` not equal to `df1`.\nNames: 2 string mismatches\n```\n\nI tried `info` option but it seems printing the info whether the test is failed or not.\n\nI'd be great if it prints the dataframes maybe with an option. For example as below:\n\n```\n== Results ==\n!== Expected Answer - 7 ==   == Actual Answer - 3 ==\n [1,0]                      [1,0]\n![1,0]                      [2,0]\n![1,0]                      [3,0]\n![2,0]                    \n![2,0]                    \n![3,0]                    \n![3,0] \n```\n\nOtherwise, maybe, it'd be nicer if it just prints the dataframe contents at least.\n\nAre they already concerned? Please let me know if there is any way to do this.\n"}}
{"actor":{"display_login":"hadley"}}