Tsallaka zuwa abun ciki
Justice Tech School

Practice: Class Report

Combine data frames, aggregation and sorting.

Example
df <- data.frame(name = c("Ada", "Kofi", "Amina", "Tunde"), group = c("A", "B", "A", "B"), score = c(92, 78, 85, 71))
res <- aggregate(score ~ group, df, mean)
print(res[order(-res$score), ])
print(df[which.max(df$score), "name"])

Exercise

Highest row.

.max(df$score)

Quiz Test

What does which.max give?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.