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

ns_to_percents and adorn_crosstab fail on a 2 column data.frame #89

Closed
3 tasks done
sfirke opened this issue Jan 27, 2017 · 0 comments
Closed
3 tasks done

ns_to_percents and adorn_crosstab fail on a 2 column data.frame #89

sfirke opened this issue Jan 27, 2017 · 0 comments

Comments

@sfirke
Copy link
Owner

sfirke commented Jan 27, 2017

dat <- data.frame(Operation = c("Login", "Posted", "Deleted"), `Total Count` = c(5, 25, 40), check.names = FALSE)

dat %>%
  ns_to_percents("row")

dat %>%
  adorn_crosstab()

Error in colSums(dat[, 2:n_col], na.rm = na.rm) :
'x' must be an array of at least two dimensions

I think this is the result of dat[, 2:n_col] returning a vector when n_col = 2. Subsetting with dat[2:n_col] seems to do it.

  • Update code
  • Check tests, add test
  • Check if any other functions might be affected by this
sfirke added a commit that referenced this issue Mar 30, 2017
@sfirke sfirke closed this as completed in bf9b39f Mar 30, 2017
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

No branches or pull requests

1 participant