79343367

Date: 2025-01-09 16:29:40
Score: 2
Natty:
Report link

This is a way of using sapply(). I am wondering if there is a way to store the result for each outcome somehow. I saw a solution using lapply() which allows storing the result for each outcome, but I am not sure how to make it work for my situation. Any advice would be appreciated.

varlist <- grep("num_weeks_", names(crao2), value=TRUE)
sapply(varlist, function(my){
  f <- as.formula(paste(my, "~ tx", sep=""))
  summary(aov(f, data=crao2))
  TukeyHSD(aov(f, data=crao2))
})
Reasons:
  • Blacklisted phrase (1): appreciated
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: brainupgraded