I have several phylogenetic GLS and would like to find a better way to summarize the results. I am not using loops to obtain several PGLS since I will be clumping several traits from different matrices. Example below:
library(caper) # for the pgls method
library(dplyr)
library(broom)
library(purrr)
data(shorebird)
birdie <- comparative.data(shorebird.tree, shorebird.data, Species)
pgls.EggVsMass <- pgls( Egg.Mass ~ M.Mass, birdie)
pgls.EggVsClutch <- pgls( Egg.Mass ~ Cl.size, birdie)
SUM.EggVsMass <- summary(pgls.EggVsMass)$coefficients
SUM.EggVsClutch <- summary(pgls.EggVsClutch)$coefficients
GL <- mget(ls(pattern = "SUM.*"))
tidier <- GL %>% purrr::map(., glance)
But the object 'tidier' is not a simple tibble and I can't properly save it. How can I improve this strategy and obtain a tibble with the information in the summary or the coefficients ?
A similar code but for lm worked so I would like to solve the PGLS in a similar way. Using map_df in the case above does not work.
LMTRAIT <- names(data)[-1] %>%
paste('trait1 ~', .) %>%
map(lm, data) %>%
purrr::map_df(., broom::glance) #
as_tibble(LMTRAIT)