{"action":"created","issue":{"url":"https://api.github.com/repos/matthieugomez/statar/issues/11","repository_url":"https://api.github.com/repos/matthieugomez/statar","labels_url":"https://api.github.com/repos/matthieugomez/statar/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/matthieugomez/statar/issues/11/comments","events_url":"https://api.github.com/repos/matthieugomez/statar/issues/11/events","html_url":"https://github.com/matthieugomez/statar/pull/11","id":176198685,"number":11,"title":"Add `statascii()`","user":{"login":"gvelasq2","id":20712598,"avatar_url":"https://avatars.githubusercontent.com/u/20712598?v=3","gravatar_id":"","url":"https://api.github.com/users/gvelasq2","html_url":"https://github.com/gvelasq2","followers_url":"https://api.github.com/users/gvelasq2/followers","following_url":"https://api.github.com/users/gvelasq2/following{/other_user}","gists_url":"https://api.github.com/users/gvelasq2/gists{/gist_id}","starred_url":"https://api.github.com/users/gvelasq2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvelasq2/subscriptions","organizations_url":"https://api.github.com/users/gvelasq2/orgs","repos_url":"https://api.github.com/users/gvelasq2/repos","events_url":"https://api.github.com/users/gvelasq2/events{/privacy}","received_events_url":"https://api.github.com/users/gvelasq2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-10T19:41:26Z","updated_at":"2016-10-25T23:50:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/matthieugomez/statar/pulls/11","html_url":"https://github.com/matthieugomez/statar/pull/11","diff_url":"https://github.com/matthieugomez/statar/pull/11.diff","patch_url":"https://github.com/matthieugomez/statar/pull/11.patch"},"body":"Changes:\r\n1. I wrote the [`statascii()`](https://gist.github.com/gvelasq2/a39348f59f4353a9478704a28f86ed69) function (an adapted version of [`asciify()`](https://gist.github.com/gavinsimpson/2b49f3026b50eeba29314398e27a6770) by @gavinsimpson) to better approximate Stata output, including right justification, Stata-like padding, various Stata table formats (`oneway`, `twoway`, and `summary`), and Unicode box drawing characters.\r\n2. I applied the `oneway` flavor in `statascii()` to one-way tables of frequencies in `tab()`, and I added a \"Total\" row.\r\n3. I applied the `summary` flavor in `statascii()` to n-way tables of frequencies when n > 1 in `tab()`, as well as to`sum_up()`.\r\n4. The detailed output option from `sum_up()` is too wide for Stata-like padding in the R console, so I created a unique, smaller padding for this option.\r\n5. `pander()` is no longer necessary.\r\n\r\nKnown issues:\r\n1. `statascii()` breaks down with wide tables that need to wrap around the R console. `pander()` has this functionality. I hope to develop a solution for this in `statascii()`.\r\n\r\nThings to discuss:\r\n1. @matthieugomez, what you think about `tab()` displaying a contingency table for two-way tables of frequencies? This would better approximate Stata `tabulate` output.\r\n2. I do like the current flat table output in `tab()` for n-way tables of frequencies when n >2 (which is an improvement over Stata's `tabulate`, yet this is possible via Stata's `table`). @matthieugomez, perhaps you’d agree with adding dashed row separators to better delineate the groups when n > 2?\r\n3. A wish list item of mine is to implement Stata `tabulate` options in a quick and easy way. Is it possible to have two `...` in a function definition in order to parse out the tab variables as well as the options? For example:\r\n\r\n`mtcars %>% tab(gear, carb, opt = m row col exp chi2 exact)`"},"comment":{"url":"https://api.github.com/repos/matthieugomez/statar/issues/comments/256211983","html_url":"https://github.com/matthieugomez/statar/pull/11#issuecomment-256211983","issue_url":"https://api.github.com/repos/matthieugomez/statar/issues/11","id":256211983,"user":{"login":"gvelasq2","id":20712598,"avatar_url":"https://avatars.githubusercontent.com/u/20712598?v=3","gravatar_id":"","url":"https://api.github.com/users/gvelasq2","html_url":"https://github.com/gvelasq2","followers_url":"https://api.github.com/users/gvelasq2/followers","following_url":"https://api.github.com/users/gvelasq2/following{/other_user}","gists_url":"https://api.github.com/users/gvelasq2/gists{/gist_id}","starred_url":"https://api.github.com/users/gvelasq2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvelasq2/subscriptions","organizations_url":"https://api.github.com/users/gvelasq2/orgs","repos_url":"https://api.github.com/users/gvelasq2/repos","events_url":"https://api.github.com/users/gvelasq2/events{/privacy}","received_events_url":"https://api.github.com/users/gvelasq2/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T23:50:44Z","updated_at":"2016-10-25T23:50:44Z","body":"@matthieugomez, I've added table wrapping functionality to `statascii()`. You can check it by running the code below.\r\n\r\n```\r\nmtcars %>%\r\n    slice(1:5) %>%\r\n    tab(mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb)\r\n```\r\n\r\nYou'll notice that if you resize your R console and rerun the `tab()` command above, `statascii()` will automatically wrap the table output based on the current R console width."}}
{"actor":{"display_login":"gvelasq2"}}