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
2
votes
1 answer

Tidy a "train" object using broom

I made a linear regression model by using the caret package with the code below library(caret) #Anscombe data is available on R model_1<-train( form=y1~x1, data=anscombe, method='lm', trControl=trainControl(method='cv',number=3)) What I…
2
votes
2 answers

Group t test result into columns within tidyverse

I'd like to group multiple t test result into one table. Originally my code looks like this: tt_data <- iris %>% group_by(Species) %>% summarise(p =…
Ian
  • 39
  • 1
2
votes
3 answers

How to replace vector tidier

I am looking to find another function that can replace the broom::tidy() function after it get removed. Here is what the broom package warning says: Tidy Atomic Vectors Vector tidiers are deprecated and will be removed from an upcoming release of…
John E.
  • 137
  • 2
  • 10
2
votes
2 answers

Many regressions using tidyverse and broom: Same dependent variable, different independent variables

This link shows how to answer my question in the case where we have the same independent variables, but potentially many different dependent variables: Use broom and tidyverse to run regressions on different dependent variables. But my question is,…
2
votes
4 answers

t-test of one group versus many groups in tidyverse

I have the following tibble test_tbl <- tibble(name = rep(c("John", "Allan", "George", "Peter", "Paul"), each = 12), category = rep(rep(LETTERS[1:4], each = 3), 5), replicate = rep(1:3, 20), …
GAURAV DIWAN
  • 158
  • 1
  • 1
  • 10
2
votes
0 answers

subscript out of bounds when using broom::tidy() on a svyglm with a non-varying term

I'm getting a subscript out of bounds error when using tidy() on a svyglm where one of the covariates does not vary: library(broom) library(tidyverse) library(survey) test.df <- tibble( id = c(1,2,3,4), weights = c(1,1,1,1), outcome =…
lost
  • 1,483
  • 1
  • 11
  • 19
2
votes
1 answer

Is there a way to pass coefficients of many simple linear regression models to corresponding columns of data and then solve for "x"?

I have 4 columns of measurement (distance) data collected using a device that measures a voltage gap on separate channels. CH_1 CH_2 CH_3 CH_4 -40160 -38180 -63972 -54560 -40160 -38140 -63972 -54552 -40168 -38168 -63972 …
LukeP
  • 93
  • 8
2
votes
1 answer

How to apply sw_glance using mutate_at to nested time-series dataframe?

I am forecasting several models on a nested (grouped) df. My issue is solved if I apply sw_glance to each list-column separately, but, for my example, if I am applying 6 models, then it is asking me to mutate six times. I have spent countless hours…
Will
  • 57
  • 4
2
votes
2 answers

A compact way to perform multiple pairwise tests (e.g. t-test) with a single variable split in multiple categories in long-format

I am interested in performing multiple tests for a single variable with an associated factor that split the values into multiple groups. It is related to this question and, actually, I would like to get a solution of that kind but it is not exactly…
Alf Pascu
  • 365
  • 3
  • 11
2
votes
1 answer

Unnest all columns of nested tibble to a list of tibbles

I am fitting a model to each group in a dataset. I am nesting the data by the grouping variable and then using map to fit a model to each group. Then I store the tidied model information as columns in a nested tibble. I'd like to save each of these…
nofunsally
  • 2,051
  • 6
  • 35
  • 53
2
votes
2 answers

How to convert list of regression outputs into data frames with broom::tidy by using lapply function?

I have a list with multiple data frames. Each data frame contains three columns (ColumnOne, ColumnTwo and ColumnThree). list <- list(df1, df2, df3) I am using lapply to run a regression on each data frame. regression <- lapply(list, function (x) …
Soph2010
  • 563
  • 3
  • 13
2
votes
1 answer

Translating an R broom/dplyr problem into Python

My goal is to port a job that I have been doing in R over to Python. I know there are packages out there that would do what I need, but I have a difficult time translating what I may normally do in R to what needs to be done in Python. The scenario…
obewanjacobi
  • 458
  • 2
  • 12
2
votes
1 answer

R purrr::map/broom::tidy Does Not Print Probability Values for GLM Model

I'm running into a problem with purrr::map and broom::tidy when running loglinear GLMs in R. For some reason, model p-values do not print when running many models but do print with a single model. In the end, I'd like the multiple models to print p…
Joe
  • 121
  • 1
  • 8
2
votes
1 answer

Augment predictions from many models in the original dataset

I want to run many models with all possible combinations of x and ys. I created the following code to do that. library(tidyverse) y <- names(mtcars) xs <- map(y, ~setdiff(names(mtcars), .x)) %>% map(~paste0(.x, collapse = "+")) %>% …
Geet
  • 2,515
  • 2
  • 19
  • 42
2
votes
1 answer

Separate GLM Variable name & value from terms

I'm trying to separate the terms column into two columns the variable used in the regression and the vale of the category. library(MASS) #> Warning: package 'MASS' was built under R version 3.5.1 library(dplyr) #> Warning: package 'dplyr' was…
Ryan John
  • 1,410
  • 1
  • 15
  • 23