Skip to content

Commit

Permalink
fixes for tibble pkg; version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
bbolker committed Apr 18, 2020
1 parent c2587ef commit a20b763
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: broom.mixed
Type: Package
Title: Tidying Methods for Mixed Models
Version: 0.2.4.9000
Version: 0.2.5
Authors@R: c(
person("Ben", "Bolker", email = "[email protected]",
role = c("aut", "cre"),
Expand Down
8 changes: 4 additions & 4 deletions R/brms_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ tidy.brmsfit <- function(x, parameters = NA,
}
}
res_list$ran_pars <-
data_frame(
dplyr::tibble(
group = sapply(ss2, grpfun),
term = sapply(ss2, termfun)
)
Expand All @@ -220,7 +220,7 @@ tidy.brmsfit <- function(x, parameters = NA,
vals <- stringr::str_match_all(rterms, "_(.+?)\\[(.+?),(.+?)\\]")

res_list$ran_vals <-
data_frame(
dplyr::tibble(
group = plyr::laply(vals, function (v) { v[[2]] }),
term = plyr::laply(vals, function (v) { v[[4]] }),
level = plyr::laply(vals, function (v) { v[[3]] })
Expand All @@ -240,7 +240,7 @@ tidy.brmsfit <- function(x, parameters = NA,
## prefixes already removed for ran_vals; don't remove for ran_pars
} else {
## if !use_effects
out <- data_frame(term = names(samples))
out <- dplyr::tibble(term = names(samples))
}
pointfun <- if (robust) stats::median else base::mean
stdfun <- if (robust) stats::mad else stats::sd
Expand Down Expand Up @@ -302,7 +302,7 @@ augment.brmsfit <- function(x, data = stats::model.frame(x), newdata = NULL,
## allow optional arguments to augment, e.g. pred.type,
## residual.type, re.form ...
pred <- do.call(stats::predict, args)
ret <- dplyr::data_frame(.fitted = pred[, "Estimate"])
ret <- dplyr::tibble(.fitted = pred[, "Estimate"])
if (se.fit) ret[[".se.fit"]] <- pred[, "Est.Error"]
if (is.null(newdata)) {
ret[[".resid"]] <- stats::residuals(x)[, "Estimate"]
Expand Down
2 changes: 1 addition & 1 deletion R/glmmADMB_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ tidy.glmmadmb <- function(x, effects = c("fixed", "ran_pars"),
)

estimate <- vv2[[rscale]]
ret <- data_frame(group = vv2$grp, term, estimate)
ret <- dplyr::tibble(group = vv2$grp, term, estimate)


if (conf.int) {
Expand Down
2 changes: 1 addition & 1 deletion R/glmmTMB_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ tidy.glmmTMB <- function(x, effects = c("ran_pars", "fixed"),
ranpar_names
)
} else {
ret <- dplyr::data_frame(component=character(0),
ret <- dplyr::tibble(component=character(0),
group=character(0),
term=character(0),
estimate=numeric(0))
Expand Down
2 changes: 1 addition & 1 deletion R/lme4_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fix_ran_vals <- function(g) {
#' \item{p.value}{P-value computed from t-statistic (may be missing/NA)}
#'
#' @importFrom plyr ldply
#' @importFrom dplyr mutate bind_rows data_frame bind_cols
#' @importFrom dplyr mutate bind_rows bind_cols
#' @importFrom tibble rownames_to_column
#' @importFrom tidyr gather spread
#' @importFrom purrr map
Expand Down
2 changes: 1 addition & 1 deletion R/mcmc_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ tidyMCMC <- function(x,
m <- if (robust) colMeans(ss) else apply(ss, 2, median)

stdfun <- if (robust) stats::mad else stats::sd
ret <- dplyr::data_frame(
ret <- dplyr::tibble(
term = names(m),
estimate = m,
std.error = apply(ss, 2, stdfun)
Expand Down
8 changes: 4 additions & 4 deletions R/nlme_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#' @importFrom plyr ldply
#' @importFrom nlme getVarCov intervals
#' @import dplyr
## @importFrom dplyr data_frame select full_join
## @importFrom dplyr tibble select full_join
#'
#' @export
tidy.lme <- function(x, effects = c("ran_pars", "fixed"),
Expand Down Expand Up @@ -152,7 +152,7 @@ tidy.lme <- function(x, effects = c("ran_pars", "fixed"),
"nonlinear models"
}
)
ret <- dplyr::data_frame()
ret <- dplyr::tibble()
} else {
vc <- nlme::getVarCov(x)
ran_prefix <- switch(rscale,
Expand Down Expand Up @@ -192,7 +192,7 @@ tidy.lme <- function(x, effects = c("ran_pars", "fixed"),
diag(vals) <- sqrt(diag(vc))
vals <- c(lwrtri(vals), sigma(x))
}
ret <- dplyr::data_frame(
ret <- dplyr::tibble(
effect = "ran_pars",
group = grpnames,
term = c(nmvec),
Expand All @@ -217,7 +217,7 @@ tidy.lme <- function(x, effects = c("ran_pars", "fixed"),
sub(re, "_\\2.\\1", nm[corterms],
perl = TRUE
)
return(dplyr::data_frame(
return(dplyr::tibble(
term = nm, conf.low = z[, "lower"],
conf.high = z[, "upper"]
))
Expand Down
2 changes: 1 addition & 1 deletion R/rstanarm_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ glance_stan <- function(x, looic = FALSE, ..., type) {
sim <- x$fit@sim
}

ret <- dplyr::data_frame(algorithm = algo)
ret <- dplyr::tibble(algorithm = algo)

if (algo != "optimizing") {
pss <- sim$n_save
Expand Down
4 changes: 2 additions & 2 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ reorder_frame <- function(x, first_cols = c("effect", "group", "term", "estimate

## FIXME: store functions to run as a list of expressions,
## allow user-specified 'skip' argument?
finish_glance <- function(ret = dplyr::data_frame(), x) {
finish_glance <- function(ret = dplyr::tibble(), x) {
stopifnot(length(ret) == 0 || nrow(ret) == 1)

## catch NULL, numeric(0), error responses
Expand All @@ -108,7 +108,7 @@ finish_glance <- function(ret = dplyr::data_frame(), x) {
return(tt)
}

newvals <- dplyr::data_frame(
newvals <- dplyr::tibble(
sigma = tfun(sigma(x)),
logLik = tfun(as.numeric(stats::logLik(x))),
AIC = tfun(stats::AIC(x)),
Expand Down
7 changes: 6 additions & 1 deletion inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\title{broom.mixed News}
\encoding{UTF-8}

\section{CHANGES IN VERSION 0.2.4.9000}{
\section{CHANGES IN VERSION 0.2.5}{
\subsection{NEW FEATURES}{
\itemize{
\item \code{lmer} tidier gets \code{ddf.method} (applies only to
Expand All @@ -13,6 +13,11 @@
\item experimental \code{GLMMadaptive} tidiers
}
}
\subsection{OTHER CHANGES}{
\itemize{
\item fixes for updates in tibble package
}
}
}
\section{CHANGES IN VERSION 0.2.4}{
\subsection{NEW FEATURES}{
Expand Down

0 comments on commit a20b763

Please sign in to comment.