Hi All,

I need to do the following operation from data.frame:

df <- data.frame(Year = c("2001", "2002", "2003", "2004", "2005", "2006",
"2007"), Amount = c(150, 120, 175, 160, 120, 105, 135))
df[which.max(df$Amount),]  #to extract row with max Amount.

Now I need to do 3 years average around the max Amount value (ie:
mean(120,175,160))

Thanks!
N

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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