working with lists of models using the pipe syntax
问题 I often like to fit and examine multiple models that relate two variables in an R dataframe. I can do that using syntax like this: require(tidyverse) require(broom) models <- list(hp ~ exp(cyl), hp ~ cyl) map_df(models, ~tidy(lm(data=mtcars, formula=.x))) But I'm used to the pipe syntax and was hoping to be able to something like this: mtcars %>% map_df(models, ~tidy(lm(data=., formula=.x))) That makes it clear that I'm "starting" with mtcars and then doing stuff to it to generate my output.