6 Visualizing a single variable

Tutorial learning objectives

In this tutorial you will:

  • Revisit how to import data and get an overview of a “tibble” object
  • Learn how to construct a frequency table
  • Learn how to include a table caption
  • Learn how to visualize the frequency distribution of a single categorical variable using a bar graph
  • Learn how to visualize the frequency distribution of a single numerical variable using a histogram
  • Learn how to describe a histogram

Background

How to best visualize data depends upon (i) whether the data are categorical or numerical, and (ii) whether you’re visualizing one variable or associations between two variables (we don’t cover how to visualize associations between more than two variables). This tutorial focuses on visualizing a single variable.

When visualizing a single variable, we aim to visualize a frequency distribution. A frequency distribution is the frequency with which unique data values occur in the dataset.

  • If the variable is categorical, we can visualize the frequency distribution using a bar graph
  • If the variable is numeric, we visualize the frequency distribution using a histogram

In this tutorial you’ll learn to construct and interpret each of these types of visualization.