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
0
votes
2 answers

How to use broom::tidy with multiple models?

I'm trying to summarize the results of 19 polynomial regression models by using broom. I've followed this SO Question and am trying to use it with broom::tidy. My script is as follows: ALTER PROCEDURE [dbo].[spRegressionPeak] @StudyID…
SidC
  • 3,175
  • 14
  • 70
  • 132
0
votes
1 answer

Merging rows will defining different parameters for each row being combined in R

I have a dataframe with different parameters in each. I'll like to merge rows using a different set of parameters for each row. Here is my sameple data ZZ: ZZ<-data.frame(Name…
Joke O.
  • 515
  • 6
  • 29
0
votes
1 answer

Tidy function is not working with USAboundaries shapefile data

I'm not understanding what the error is as the tidy function works fine with other shapefiles, is USAboundaries missing something? library(USAboundaries) library(broom) states_dat <- tidy(us_states(), region = "geoid") ##> states_dat <-…
SCDCE
  • 1,603
  • 1
  • 15
  • 28
0
votes
0 answers

Error installing Broom and Nlme package in R

I am currently using RStudio for R right now. I am trying to use the broom::tidy function but am unable to install the broom package. install.packages("broom") generates the error: ERROR: dependency ‘nlme’ is not available for package ‘psych’ …
rebeccah
  • 1
  • 3
0
votes
1 answer

ggplot2, broom: how to add lines to plot of factor vs. continuous variable

In the plot below, I show values of $R^2$ from a set of models fit to subsets of a data set using dplyr and broom. I'd like to connect the points by lines, or else draw horizontal lines to each point, as in a traditional dot plot. How can I do…
user101089
  • 3,756
  • 1
  • 26
  • 53
0
votes
1 answer

broom::augment: Evaluation error: object not found with gamlss but all good with lm

I'm wrestling with collecting gamlss results into a data frame. This continues the example here Working example using lm library(tidyverse) library(broom) library(gamlss) library(datasets) # working mro <- mtcars %>% nest(-am) %>% mutate(am…
Hedgehog
  • 5,487
  • 4
  • 36
  • 43
0
votes
1 answer

use model object, e.g. panelmodel, to flag data used

Is it possible in some way to use a fit object, specifically the regression object I get form a plm() model, to flag observations, in the data used for the regression, if they were in fact used in the regression. I realize this could be done my…
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
0
votes
1 answer

Using broom::tidy on felm result with clustered standard errors

I'm trying to extract point estimates and confidence intervals from a panel data model. The following reproduces the error using the canned example from the lfe documentation. The only small change I've made is to cluster standard errors at the…
jfeigenbaum
  • 403
  • 4
  • 13
0
votes
2 answers

tidy from broom not finding method for LDA from topicmodels

Running this script, straight from 'Text mining with R', library(topicmodels) library(broom) data("AssociatedPress") ap_lda <- LDA(AssociatedPress, k = 2, control = list(seed = 1234)) tidy(ap_lda) I get this error message: Error in…
Isaiah
  • 53
  • 7
0
votes
1 answer

Cannot install broom package

I am having terrible trouble installing the broom package on my windows PC I have tried installing from source using the .tar.gz and from CRAN using dependencies = TRUE, all to no avail. 'C:\Program' is not recognized as an internal or external…
llewmills
  • 2,959
  • 3
  • 31
  • 58
0
votes
0 answers

How can I add new variables to a data.frame within a function?

Given the data.frame df obtained within the function myfunc, how can I add some more columns to df within the function? It works if done manually outside the function: require("broom") myfunct <- function(mylabel1, mylabel2){ df <-…
AJMA
  • 1,134
  • 2
  • 13
  • 28
0
votes
1 answer

Wrong lat/long using fortify, broom::tidy

I'm having some trouble with the broom::tidy function. This might be specific to my shapefile (which is a map of all rivers in Alaska). I load the file using the readOGR function shp <- readOGR(dsn = ".","mv_navigable_water_ln") And then fortify…
John Harley
  • 156
  • 1
  • 6
0
votes
2 answers

Clean way to reorder tidyr spread after nest and purrr map

Consider the following: library(tidyverse) library(broom) tidy.quants <- mtcars %>% nest(-cyl) %>% mutate(quantiles = map(data, ~ quantile(.$mpg))) %>% unnest(map(quantiles, tidy)) tidy.quants #> # A tibble: 15 x 3 #> cyl names x #>…
JasonAizkalns
  • 20,243
  • 8
  • 57
  • 116
0
votes
1 answer

How to run nlxb and wrapnls inside dplyr?

I am trying to fit many nonlinear fits using wrapnls in parallel using dplyr and broom (and eventually mclapply), but I am getting a parsing evaluation error from nlxb: Error in parse(text = joe) (from #11) : :1:6: unexpected input 1: b1.10%…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
0
votes
1 answer

how to write a function that uses broom, dplyr and lm?

Consider this very 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…
ℕʘʘḆḽḘ
  • 18,566
  • 34
  • 128
  • 235