[R] Looping through different groups of variables in models
Kai Mx
govokai at gmail.com
Wed Aug 31 23:58:41 CEST 2016
Hi all,
I am having trouble wrapping my head around a probably simple issue:
After using the reshape package, I have a melted dataframe with the columns
group (factor), time (int), condition (factor), value(int).
These are experimental data. The data were obtained from different
treatment groups (group) under different conditions at different time
points.
I would now like to perform ANOVA, boxplots and calculate means to compare
groups for all combinations of conditions and time points with something
like
fit <- lm(value~group, data=[subset of data with combination of
condition/timepoint])
summary (fit)
p <- ggplot([subset of data with combination of condition/timepoint],
aes(x= group, y=value)) + geom_boxplot ()
print (p)
tapply ([subset of data with combination of condition/timepoint]$value,
subset of data with combination of condition/timepoint]$group, mean)
How can I loop through these combinations and output the data in an elegant
way?
Thanks so much!
Best,
Kai
[[alternative HTML version deleted]]
More information about the R-help
mailing list