LoslegenKostenlos loslegen

Contingency table review

In this chapter you'll continue working with the comics dataset introduced in the video. This is a collection of characteristics on all of the superheroes created by Marvel and DC comics in the last 80 years.

Let's start by creating a contingency table, which is a useful way to represent the total counts of observations that fall into each combination of the levels of categorical variables.

Diese Übung ist Teil des Kurses

Exploratory Data Analysis in R

Kurs anzeigen

Anleitung zur Übung

The dataset has been loaded into your workspace as comics.

  • Type the name of the dataset to look at the rows and columns of the dataset.
  • View the levels() that the align variable can take.
  • View the levels() that the gender variable can take.
  • Create a contingency table of the same two variables.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Print the comics data


# Check levels of align
levels(___$___)

# Check the levels of gender


# Create a 2-way contingency table
Code bearbeiten und ausführen