Skip to content
Prev 315148 / 398506 Next

How to extract value for specific rows in an array?

Hello,

If you want the maximum depth for each day, ?aggregate will do it. If 
you also want the date column, use ?merge after it.


dat <- read.table(text = "
Date            Day           Depth
18442.00    29              41.0
18442.00    29              43.5
18442.04    29              40.3
18442.04    29              35.1
18443.00    30              16.5
", header = TRUE)

agg <- aggregate(Depth ~ Day, data = dat, FUN = max)
merge(agg, dat)


Hope this helps,

Rui Barradas
Em 12-01-2013 05:32, fjaine escreveu: