Dear R users,

This is a trivial question, there might even be an R function for it, but I have
to do it many times and wonder if there is an efficient for it.


Suppose we have a data frame like this:
d <- data.frame(x=sample(seq(0.1:1, by=0.01), size=100, replace=TRUE),
y=rnorm(100, 0.2, 0.6))

and want to have the average of y for a given interval of x, for example
mean(y)[0>x>0.1]. Is there a simple way of doing this or I need to improvise?

Thank you so much for any help
Eleni Rapsomaniki

______________________________________________
[email protected] mailing list
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.

Reply via email to