bbolker / broom.mixed

tidy methods for mixed models in R
227 stars 23 forks source link

changes for dplyr 1.0.0 #95

Closed romainfrancois closed 4 years ago

romainfrancois commented 4 years ago

This uses as.tbl_cube() from cubelyr and relaxes a test, because in this function:

tidy.gls <- function(x,
                     conf.int = FALSE,
                     conf.level = 0.95,
                     ...) {
  . <- Value <- Std.Error <- `t-value` <- `p-value` <- NULL ## glob var checks
  ret <- (summary(x)[["tTable"]]
      %>% as.data.frame() ## have to convert to df *first*
      %>% tibble::rownames_to_column(var = "term")
      %>% as_tibble()
      %>%  dplyr::rename(
                      estimate = Value,
                      std.error = Std.Error,
                      statistic = `t-value`,
                      p.value = `p-value`
                  )
  )
  if (conf.int) {
      cc <- (confint(x, level=conf.level)
          %>% as.data.frame()
          %>% setNames(c("conf.low","conf.high"))
      )
      ret <- dplyr::bind_cols(ret,cc)
  }
  return(ret)
}

ret inherits the row.names from cc, alternatively, this could be

row.names(cc) <- NULL