Skip to content
Justice Tech School

Summaries of Data Frames

summary(), head(), str() and table() describe a data frame quickly.

Example
df <- data.frame(g = c("a", "b", "a", "b"), v = c(1, 2, 3, 4))
print(head(df, 2))
print(summary(df$v))
print(table(df$g))
print(tapply(df$v, df$g, sum))

Exercise

Quick summary.

(df$v)

Quiz Test

What does tapply do?

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