Session Ready
Exercise

Run a linear model

You can use map() to do more than just take the square root of a number or simulate data. You can also use map() to loop over different inputs to run several models, each using the unique values of a given list element. You can also then iterate over the models you've run to create the model summaries and look at the results.

The lists sites and list_of_df are preloaded.

Instructions
100 XP
  • Pipe list_of_df into map() along with the lm() linear model function, to compare a as the response and b as the predictor variable.
    • Use the syntax: lm(response ~ predictor, data = )
  • Then pipe the linear model output into map() and generate the summary() of each model.