What's a data frame?

You may remember from the chapter about matrices that all the elements that you put in a matrix should be of the same type. Back then, your data set on Star Wars only contained numeric elements.

When doing a market research survey, however, you often have questions such as:

The output, namely the respondents' answers to the questions formulated above, is a data set of different data types. You will often find yourself working with data sets that contain different data types instead of only one.

A data frame has the variables of a data set as columns and the observations as rows. This will be a familiar concept for those coming from different statistical software packages such as SAS or SPSS.

Instruction

Click 'Submit Answer'. The data from the built-in example data frame mtcars will be printed to the console.

# Print out built-in R data frame mtcars # Print out built-in R data frame mtcars test_output_contains("mtcars", incorrect_msg = "Do not change anything about the code, Make sure that you output `mtcars`.") success_msg("Great! Continue to the next exercise.")

Just click 'Submit Answer' and witness the magic!

Previous: 4-9 | Comparing ordered factors

Next: 5-2 | Quick, have a look at your data set

Back to Main