I'm trying to figure out how can I set up purrr to run several multiple regressions like the image below. As you will notice, this dataset describes an intervention program and we are analyzing this data using ANCOVA procedures (TIME 2 ~ TIME 1 + CONDITION).
om4g**TIME2**01 ~ om4g**TIME1**01 + CONDITION
example:
om4g201 ~ om4g01 + CONDITION
Just in case someone want a reproducible code:
dataset <- data.frame(rest201=c(10,20,30,40),
rest101=c(5,10,20,24),
omgt201=c(40,10,20,10),
omgt101=c(10,20,10,05),
CONDITION=c(0,1))
lm(rest201~rest101+CONDITION, data=dataset)
lm(omgt201~omgt101+CONDITION, data=dataset)
I found just one similar question than mine here (Making linear models in a for loop using R programming) but the answer was not working.
Thanks!