Dear all,
I would like to do multiple actions on a subset of my data. Therefore, I want
to create a for loop on the variable "Date" (actually a double for loop on yet
another variable, but let's omit that for a moment).
I want to run down every level of "Date" and perform multiple actions on the
data from a certain date. Here is my code:
for (i in 1:length(datums)){
meanweight<-mean(dataset1[dataset1$Date==datums[i],]$Weight)
...
However, this subsetting obviously doesn't work. How can I adjust my code so
that R runs down all levels of Data in a for loop?
(I need the for loop, not tapply(), sapply(), ...)
Thanks in advance,
Dieter Anseeuw
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.