Hello Jeff, thank you for the reply. I tried the cut function and I had two questions. How do I have the cut function take the first position in the start column in df1 as the first cut point and the first position in column 2 as the second cut point. The break variable seems to want a single vector. I tried compressing both vectors into one where I had say
200 700 500 1000 etc then cut gives me the 200-500 range, 500-700, and 700-1000. In this case I wanted the range, 200-700, and 500-1000. Is there a way to define the first point of each cut as positions along the START vector and all second points of the cut as positions along the END vector? I also had one additional question. When playing around with this, I noticed that I had to do this for the Pos column in the second data frame. But, when I get the ranges, how do I have it return the values in C0 or C1 in df2 that are in the same rows as those of the ranges? Thanks again for the help. -- View this message in context: http://r.789695.n4.nabble.com/Averaging-within-a-range-of-values-tp4291958p4293410.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.