This is related to the questions 1 and 2
I have a list of objects (in my case they are also lists AFAII), as returned by running:
gof_stats <- models %>% map(gof_stats)
Where models
is a list of models created by fitdistrplus
and gof_stats
is a function that computes goodness of fit stats for each model.
Now if I want to extract a specific stat from that list I could do something like:
gof_stats[[1]]$cvm
to get the Cramer von Mises stat. I can achieve the same over the whole list (as per the linked questions) like so:
cvms <- sapply(gof_stats, "[[", "cvm")
Is there a way to do the same using dplyr
/purrr
syntax?
BONUS: How would you handle the case where some of the elements in the models
list are NULL
?