Hi Elise,
Are the numbers it returns integers? This is likely because your categorial data is a factor. Factors are just integer vectors with labels (e.g high, medium, low). Factors can be ordered (e.g. elementary school, high school, college) or unordered (green, yellow, pink). If your column is an ordered factor, max works automatically. So:
> set.seed(0)
> d <- data.frame(country=sample(letters[1:5], 10, replace=TRUE))
> d$edu <- factor(sample(c("high school", "college", "elementary school"), 10, replace=TRUE), levels=c("elementary school", "high school", "college"), ordered=TRUE)
> d
country edu
1 e high school
2 b high school
3 b high school
4 c elementary school
5 e college
6 b elementary school
7 e college
8 e elementary school
9 d elementary school
10 d college
> aggregate(d$edu, list(country=d$country), max)
country x
1 b high school
2 c elementary school
3 d college
4 e college
> d$edu
[1] high school high school high school elementary school
[5] college elementary school college elementary school
[9] elementary school college
Levels: elementary school < high school < college
> d$country
[1] e b b c e b e e d d
Levels: b c d e
Note how countries are unordered and edu is ordered. R's generics for max, min, and comparison operators understand this ordering:
> d$edu < rev(d$edu)
[1] TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE FALSE
> rev(d$edu)
[1] college elementary school elementary school college
[5] elementary school college elementary school high school
[9] high school high school
Levels: elementary school < high school < college
> d$edu
[1] high school high school high school elementary school
[5] college elementary school college elementary school
[9] elementary school college
Levels: elementary school < high school < college
So the solution is just make sure you're using ordered factors — R will take care of the rest!
HTH,
Vince