Skip to content
Prev 165373 / 398506 Next

Summary information by groups programming assitance

Here are two solutions assuming DF is your data frame:

# 1. aggregate is in the base of R

aggregate(DF[c("Length", "vol")], DF[c("Lake", "psd")], max)

or the following which is the same except it labels psd as Category:

aggregate(DF[c("Length", "vol")], with(DF, list(Lake = Lake, Category
= psd)), max)


# 2. sqldf.  The sqldf package allows specification using SQL notation:

library|(sqldf)
sqldf("select Lake, psd as Category, max(Length), max(vol) from DF
group by Lake, psd")

There are many other good solutions too using various packages which
have already
been mentioned on this thread.

On Mon, Dec 22, 2008 at 4:51 PM, Ranney, Steven
<steven.ranney at montana.edu> wrote: