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

replace colnames with names in tidy.polr (#497) #498

Merged
merged 2 commits into from Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Expand Up @@ -44,6 +44,10 @@ The following have all been deprecated in favor of `broom.mixed`:
- `tidy.lme()`, `glance.lme()`, `augment.lme()`
- `tidy.stanreg()`, `glance.stanreg()`

## Other changes

- Bug fix for tidy.polr for incorrectly using colnames. (#498)

# broom 0.5.0

Tidiers now return `tibble::tibble()`s. This release also includes several new tidiers, new vignettes and a large number of bugfixes. We've also begun to more rigorously define tidier specifications: we've laid part of the groundwork for stricter and more consistent tidying, but the new tidier specifications are not yet complete. These will appear in the next release.
Expand Down
4 changes: 4 additions & 0 deletions R/mass-polr-tidiers.R
Expand Up @@ -32,6 +32,10 @@ process_polr <- function(ret, x, conf.int = FALSE, conf.level = .95,

if (conf.int) {
CI <- suppressMessages(trans(stats::confint(x, level = conf.level)))
if (!is.matrix(CI)) {
CI <- rbind(CI)
rownames(CI) <- names(coef(x))
}
colnames(CI) <- c("conf.low", "conf.high")
CI <- as.data.frame(CI)
CI$term <- rownames(CI)
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-mass-polr.R
Expand Up @@ -7,6 +7,7 @@ skip_if_not_installed("MASS")
library(MASS)

fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
fit2 <- polr(Sat ~ Freq, data = housing)

test_that("MASS::polr tidier arguments", {
check_arguments(tidy.polr)
Expand All @@ -18,12 +19,15 @@ test_that("tidy.polr", {

td <- tidy(fit, quick = TRUE)
td2 <- tidy(fit, conf.int = TRUE, exponentiate = TRUE)
td3 <- tidy(fit2, conf.int = TRUE, exponentiate = TRUE)

check_tidy_output(td, strict = FALSE)
check_tidy_output(td2, strict = FALSE)
check_tidy_output(td3, strict = FALSE)

check_dims(td, expected_cols = 3)
check_dims(td2, expected_cols = 7)
check_dims(td3, expected_cols = 7)
})

test_that("glance.polr", {
Expand Down