5. Data Frames

Learn R data frames โ€” the table type most real statistics and data analysis in R is built on โ€” with live, editable code.

A data frame is Rโ€™s table type โ€” a set of equal-length columns, each possibly a different type. This is what most real statistics and data analysis in R is built on.

Discuss first

Before you run the code below: students$score is c(92, 88, 95). Which rows do you expect students[students$score > 90, ] to keep โ€” how many, and whose?

Edit the code below if you like, then press Run Code to check your answer.

Check your understanding

Q1. How do you pull out just the score column from the students data frame?

Q2. Fill in the blank: the function used to build a table out of equal-length column vectors is:

(name = ..., score = ...)
Back to top