diff --git a/DESCRIPTION b/DESCRIPTION index 64ba54f..3ce0822 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "bolker@mcmaster.ca", role = c("aut", "cre"), diff --git a/R/brms_tidiers.R b/R/brms_tidiers.R index c4a891f..75d5ae7 100644 --- a/R/brms_tidiers.R +++ b/R/brms_tidiers.R @@ -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) ) @@ -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]] }) @@ -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 @@ -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"] diff --git a/R/glmmADMB_tidiers.R b/R/glmmADMB_tidiers.R index e31ecc8..93b8e41 100644 --- a/R/glmmADMB_tidiers.R +++ b/R/glmmADMB_tidiers.R @@ -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) { diff --git a/R/glmmTMB_tidiers.R b/R/glmmTMB_tidiers.R index e0cbf91..dde84cf 100644 --- a/R/glmmTMB_tidiers.R +++ b/R/glmmTMB_tidiers.R @@ -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)) diff --git a/R/lme4_tidiers.R b/R/lme4_tidiers.R index 96f2b73..af625ad 100644 --- a/R/lme4_tidiers.R +++ b/R/lme4_tidiers.R @@ -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 diff --git a/R/mcmc_tidiers.R b/R/mcmc_tidiers.R index 3e1a014..9df78e9 100644 --- a/R/mcmc_tidiers.R +++ b/R/mcmc_tidiers.R @@ -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) diff --git a/R/nlme_tidiers.R b/R/nlme_tidiers.R index cb488b3..09f3945 100644 --- a/R/nlme_tidiers.R +++ b/R/nlme_tidiers.R @@ -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"), @@ -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, @@ -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), @@ -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"] )) diff --git a/R/rstanarm_tidiers.R b/R/rstanarm_tidiers.R index 5a890e3..9b4950b 100644 --- a/R/rstanarm_tidiers.R +++ b/R/rstanarm_tidiers.R @@ -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 diff --git a/R/utilities.R b/R/utilities.R index a477848..4bddac4 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -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 @@ -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)), diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 153b651..9caee79 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -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 @@ -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}{