8000 Trouble with adorning Ns on a single column · Issue #456 · sfirke/janitor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Trouble with adorning Ns on a single column #456

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

Closed
sfirke opened this issue Aug 31, 2021 · 2 comments · Fixed by #466
Closed

Trouble with adorning Ns on a single column #456

sfirke opened this issue Aug 31, 2021 · 2 comments · Fixed by #466
Milestone

Comments

@sfirke
Copy link
Owner
sfirke commented Aug 31, 2021

I'm not sure what's going on with this, seems like a bug. It's not erroring, but also not adorning:

library(janitor)
x %>%
  select(pct) %>%
  adorn_ns(position = "front", ns = x[, "n"])

# A tibble: 6 x 1
    pct
  <dbl>
1 0.111
2 0.133
3 0.156
4 0.178
5 0.2  
6 0.222
@sfirke
Copy link
Owner Author
sfirke commented Aug 31, 2021

Maybe it's skipping the first column by default - but I can't seem to override that with a tidyselect specification to ...:
Same result:

library(janitor)
x %>%
  select(pct) %>%
  adorn_ns(position = "front", ns = select(x, n), pct)

@sfirke
Copy link
Owner Author
sfirke commented Dec 9, 2021

Better reprex:

x <- mtcars %>% tabyl(am, cyl) %>% adorn_percentages() %>% rename(a = `4`)
# No adorning, regardless of whether I specify the col to adorn:
x %>% select(a) %>% adorn_ns(ns = select(attr(x, "core"), a = `4`))
x %>% select(a) %>% adorn_ns(ns = select(attr(x, "core"), a = `4`),,,, a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0