Maybe this is simple but I can\'t find answer on web. I have problem with mean calculation by factors by level. My data looks typicaly:
factor, value a,1 a,2 b,1
The following code asks for the mean of value when factor = a:
mean(data$value[data$factor == "a"])