Let's take a look at the following steps and learn how to use the summarise() verb to summarize the dataset:
- In the first step, import the dataset into the R environment as follows:
USAairlineData2016 <- read.csv("USAairlineData2016.csv", as.is = T)
- Now, we will take a look at the following four scenarios that depict all the operations mentioned in the beginning of this recipe:
- One operation on one variable: The summarise() verb will take the input of a single variable and produce a single-valued output. In the following example, it takes the DEP_DELAY variable as an input and produces mean delay as an output:
meanDelay <- USAairlineData2016 %>% select(ORIGIN, DEST, DEP_DELAY) %>% group_by(ORIGIN,DEST) %>% summarise(meanDelay ...