Learn

One of the most appealing aspects of dplyr is the ability to easily manipulate data frames. Each of the dplyr functions you will explore takes a data frame as its first argument.

The pipe operator, or %>%, helps increase the readability of data frame code by piping the value on its left into the first argument of the function that follows it. For example:

df %>% head()

pipes the data frame df into the first argument of head(), becoming

head(df)

The true power of pipes comes from the ability to link multiple function calls together. Once you learn some of dplyr’s functions, we’ll revisit pipes and see how they are so useful!

Note: the pipe operator is not a part of base R. It comes from the magrittr package, but do not worry about loading magrittr in your code. Any time you load a package from the tidyverse, like dplyr, %>% will automatically be loaded!

Instructions

1.

Use a pipe %>% to inspect artists with head().

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?