Making a loop for lme() in r

后端 未结 3 926
死守一世寂寞
死守一世寂寞 2021-01-16 09:51

I am trying to use lme function from nlme package inside a for loop. I have tried (almost) everything now, but without any luck. Without the loop my lme function are working

3条回答
  •  野的像风
    2021-01-16 10:23

    Solution: My loop is working now with this simple code:

    lipid <-as.data.frame(cer_data[,c(7:9)]) dim(lipid) for (i in 1:length(lipid)) { variable <- lipid[,i] lme_cer <- lme(variable ~ factor(Remission) + Time + Age + BMI + SEX, random = ~1 | Lacal.Patient.ID, method = "REML", data = cer_data) print(summary(lme_cer)$tTable) }

    Thank you all for the amazing help!

提交回复
热议问题