replacing `.x` with column name after running `map::purrr()` function
问题 I run lm() for every column of a dataset with one of the column as the dependent variable, using purrr:map() function. The results are almost perfect except for this - I want to replace .x in the results with the variable that i run lm() for. The post R purrr map show column names in output is related but I want to avoid creating a function. Below, are the codes using the mtcars dataset. I know, for example that .x for the first output refers to $mpg . I am not sure if setNames() will work.