Basic dplyr usage

We have already used some dplyr commands in the previous section and, here, we'll be looking at the standard functions.  dplyr provides a set of useful verbs that can be used in conjunction with one another (using the pipe operator or otherwise) to produce the final result.

These verbs are set out in the following list:

    • sample_n and sample_frac: To extract random values
    • summarise: To aggregate values
    • mutate: To add new variables
    • arrange: To sort the dataset
    • filter: To filter the data and extract relevant rows
    • Select: To select columns from the dataset

Get Hands-On Data Science with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.