Skip to content
New issue

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

Imperfect padding of distance between % and n #121

Closed
sfirke opened this issue May 31, 2017 · 2 comments
Closed

Imperfect padding of distance between % and n #121

sfirke opened this issue May 31, 2017 · 2 comments

Comments

@sfirke
Copy link
Owner

sfirke commented May 31, 2017

Look at the right-most column here. I guess I never had test coverage for this case? This is from the dev branch where I'm redoing tabyl and the adornments.

> t2 <- mtcars %>%
+     tabyl(carb, cyl)
> 
> t2
  carb 4 6 8
1    1 5 2 0
2    2 6 0 4
3    3 0 0 3
4    4 0 4 6
5    6 0 1 0
6    8 0 0 1

 
t2 %>%
+     adorn_totals("col") %>%
+     adorn_percentages("row") %>%
+     adorn_pct_formatting(digits = 2) %>%
+     adorn_ns()
  carb          4           6           8        Total
1    1 71.43% (5)  28.57% (2)   0.00% (0)  100.00% (7)
2    2 60.00% (6)   0.00% (0)  40.00% (4) 100.00% (10)
3    3  0.00% (0)   0.00% (0) 100.00% (3)  100.00% (3)
4    4  0.00% (0)  40.00% (4)  60.00% (6) 100.00% (10)
5    6  0.00% (0) 100.00% (1)   0.00% (0)  100.00% (1)
6    8  0.00% (0)   0.00% (0) 100.00% (1)  100.00% (1)

@sfirke sfirke moved this from To Do - tabyl to To Do - adornments in Redoing tabyl and its adornments Jun 15, 2017
@sfirke sfirke removed this from To Do - adornments in Redoing tabyl and its adornments Jun 15, 2017
@sfirke sfirke added this to To Do - adornments in Redoing tabyl and its adornments Jun 15, 2017
@sfirke
Copy link
Owner Author

sfirke commented Sep 22, 2017

This was not a problem with adorn_crosstab:

> t2 %>% adorn_crosstab("col", show_totals = TRUE)
  carb         4         6         8      Total
1    1 45.5% (5) 28.6% (2)  0.0% (0) 21.9%  (7)
2    2 54.5% (6)  0.0% (0) 28.6% (4) 31.2% (10)
3    3  0.0% (0)  0.0% (0) 21.4% (3)  9.4%  (3)
4    4  0.0% (0) 57.1% (4) 42.9% (6) 31.2% (10)
5    6  0.0% (0) 14.3% (1)  0.0% (0)  3.1%  (1)
6    8  0.0% (0)  0.0% (0)  7.1% (1)  3.1%  (1)

@sfirke
Copy link
Owner Author

sfirke commented Sep 22, 2017

Quite ugly:

> t2 %>%
+   adorn_totals("col") %>%
+   adorn_percentages("row") %>%
+   adorn_pct_formatting(digits = 0) %>%
+   adorn_ns("front")
  carb       4        6        8     Total
1    1 5 (71%)  2 (29%)   0 (0%)  7 (100%)
2    2 6 (60%)   0 (0%)  4 (40%) 10 (100%)
3    3  0 (0%)   0 (0%) 3 (100%)  3 (100%)
4    4  0 (0%)  4 (40%)  6 (60%) 10 (100%)
5    6  0 (0%) 1 (100%)   0 (0%)  1 (100%)
6    8  0 (0%)   0 (0%) 1 (100%)  1 (100%)

sfirke added a commit that referenced this issue Sep 22, 2017
would like to do this w/o stringr
@sfirke sfirke moved this from To Do - adornments to Done on dev branch in Redoing tabyl and its adornments Oct 3, 2017
@sfirke sfirke closed this as completed in 0897560 Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

1 participant