Hello,

I am having a little trouble finding the right set of criteria to subset a
portion of data. I am using an instrument that does depth profiles of a
water column. The instrument records on the way down as well as the way up.

## So I am left with data like this:

dat <- data.frame(var = runif(11, 0, 10))
dat$depth <- c(1:5,5,5:1)

# So for the example
dat

## I am trying tp figure out how to subset the data so that all data
collected at the maximum depth and those collected on the way UP the water
column are used and the data collected on the way DOWN through the water
column are discarded. I got stumped by the fact that I can't just ask R for
all values less than the maximum depth.

## So I've tried determining the row number of the maximum depth value and
discarding all values above that but so far I haven't been able to figure
this out.

which.max(dat$depth)


Can anyone recommend a better strategy to figure this out?

Thanks so much in advance.

Sam

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to