Questions tagged [broom]

broom is an R package for converting statistical analysis objects into "tidy" data frames

Thebroom package provides functions for converting statistical analysis objects into "tidy" tibbles in the R programming language.

The three main verbs of broom are:

  • tidy() summarizes information about model components;
  • glance() reports information about the entire model;
  • augment() adds informations about observations to a dataset.

For more information:

339 questions
1
vote
1 answer

broom::tidy not working with purrr::map_dfr

I am trying to create a dataframe that contains tidy results from broom package for Wilcox's tests. I have been able to write code that runs this test for all grouping variables and creates a list column containing results from these tests. Now I…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
1
vote
1 answer

grouped t-test with more than two levels in grouping factor

I have the following data frame: structure(list(Name = c("BACKGROUND_VL_1_100_H", "BACKGROUND_VL_1_100_G", "BACKGROUND_VL_1_100_F", "BACKGROUND_VL_1_100_E", "BACKGROUND_VL_1_100_D", "BACKGROUND_VL_1_100_C", "BACKGROUND_VL_1_100_B",…
BCArg
  • 2,094
  • 2
  • 19
  • 37
1
vote
1 answer

Error message when using broom to get coefficients from glmmTMB zero inflation models

Using the Owls data and the glmmTMB package, I want to visually compare the regression coefficients from different zero-Inflated models that differ in the family used (ZIPOISS, ZINB1, ZINB2) and with/out the offset (logBroodSize). However my first…
1
vote
0 answers

broom::tidy or glance with rms::lrm now results in error

I was previously able to use broom::tidy and broom::glance on rms::lrm objects. However, trying to do so now results in errors. Previously, broom::tidy on a rms:lrm object would provide the following (values are made up): term estimate …
nofunsally
  • 2,051
  • 6
  • 35
  • 53
1
vote
1 answer

Fitting many GAMs and extracting derivatives using dplyr, etc

I need to fit a GAM to a time series of satellite-derived phenology data (EVI) for >1000 bird nests across North America. The GAM looks like this: EVI ~ s(Day) This model needs to be fit for each nest in multiple years. After fitting the GAM, I…
Jason
  • 892
  • 1
  • 8
  • 19
1
vote
2 answers

How can I get a "tidy" result from purrr::map2?

Given a data frame containing two repeated measures of different variables (i.e. A1, A2, B1, B2) library(purrr) library(tidyr) library(broom) set.seed(123) my_df = data.frame(matrix(rnorm(80), nrow=10)) colnames(my_df) <- c("A1_BEFORE",…
AJMA
  • 1,134
  • 2
  • 13
  • 28
1
vote
1 answer

TukeyHSD and multcompView with dplyr and broom in R

It is mentioned in broom website that it can be used for TukeyHSD and multcomp (See here). However, I could not figure it out how to use broom for TukeyHSD and multcomp. See MWE given below. df1 <- data.frame( Rep = factor(rep(1:3, each = 4, times…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
1
vote
1 answer

how to create a variable based on lm in a regular mutate in dplyr?

Consider this simple example: library(dplyr) library(broom) dataframe <- data_frame(id = c(1,2,3,4,5,6), group = c(1,1,1,2,2,2), value = c(200,400,120,300,100,100)) # A tibble: 6 x 3 id group…
ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235
1
vote
0 answers

Unable to get confidence intervals using broom for a gamlss model with a sigma.formula term

I am fitting a gamlss model with the call: model <- gamlss(formula = formula("y_variable ~ image_name + random(biological_source_name) - 1"), sigma.formula = formula("~ biological_source_name - 1"), family = "NBI", data =…
Michael Barton
  • 8,868
  • 9
  • 35
  • 43
1
vote
1 answer

Use multiple predictors in linear model with purrr map2 function

My question is similar to this one, but now I am trying to use a model with multiple predictors and I can't figure out how to get the newdata into the predict…
jkgrain
  • 769
  • 5
  • 20
1
vote
1 answer

modelr::bootstrap or broom::bootstrap and grouping problems

I have one long dataset that is composed of several datasets resulting from multiple imputations (let's say 10 imputations). They have an id variable identifying the imputation. On each of these imputed datasets I would like to bootstrap 10…
RNB
  • 457
  • 1
  • 5
  • 14
1
vote
2 answers

How to fit distribution on multiple columns using broom and dplyr

I have the following data: library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff,…
neversaint
  • 60,904
  • 137
  • 310
  • 477
1
vote
2 answers

How to tidy multiple pairwise.t.tests in R with broom

I am wondering how to tidy the following: First I gather a selection of columns into a tibble with three columns: strain (=grouping factor), params (names of parameters) and values (the actual values) sel <- t_tcellact %>% select(strain,…
robsn81
  • 11
  • 1
1
vote
2 answers

bootstrapping by multiple groups in dplyr

I'm trying to bootstrap a bivariate correlation grouped by multiple variables in a tidy fashion. So far I've got: paks <- c('dplyr','tidyr','broom') lapply(paks, require, character.only=TRUE) set.seed(123) df <- data.frame( …
DrPineapple
  • 321
  • 1
  • 4
  • 13
1
vote
1 answer

How to use broom library with purrr while using safely function?

Data > dput(dg_sample) structure(list(PrecVehVelkm.level = structure(c(11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,…
umair durrani
  • 5,597
  • 8
  • 45
  • 85