Session Ready
Exercise

Simple sampling with dplyr

Throughout this chapter you'll be exploring song data from Spotify. Each row of the dataset represents a song, and there are 1000 rows. Columns include the name of the song, the artists who performed it, the release year, and attributes of the song like its duration, tempo, and danceability. We'll start by looking at the durations.

Your first task is to sample the song dataset and compare a calculation on the whole population and on a sample.

spotify_population is available and dplyr is loaded.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Use View() to view the spotify_population dataset. Explore it in the viewer until you are clear on what it contains.
  • Use dplyr to sample 1000 rows from spotify_population, assigning to spotify_sample.