Skip to content

Instantly share code, notes, and snippets.

@qoelet
Last active January 4, 2016 21:49
Show Gist options
  • Save qoelet/8683344 to your computer and use it in GitHub Desktop.
Save qoelet/8683344 to your computer and use it in GitHub Desktop.
# calculating annual maxima from a time series (df)
df$year <- floor_date(df$date, "year")
df_maxima <- ddply(df, "year", summarise, orders=max(orders))
head(arrange(df_maxima, desc(orders), 3) # top 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment