How to perform group-wise linear regression for a data frame in R

Please format your post.

My advice is to think about the param that lm takes to establish the data it should use. If the nest operation produced an appropriate table and had it in a list column called data , then its that that should be used, and certainly not the entire unnested dataset (data_5)

I gave similar recommendation when do was discussed.