Complete the code to chain the operations using the pipe operator.
library(dplyr) data <- data.frame(x = 1:5, y = 6:10) result <- data [1] filter(x > 2)
The pipe operator %>% passes the data to the next function.
Complete the code to select column 'y' after filtering.
library(dplyr) data <- data.frame(x = 1:5, y = 6:10) result <- data %>% filter(x > 2) [1] select(y)
Use %>% again to continue chaining operations.
Fix the error in the pipe chain to calculate the mean of column 'y'.
library(dplyr) data <- data.frame(x = 1:5, y = 6:10) mean_y <- data %>% filter(x > 2) [1] summarise(mean_y = mean(y))
The pipe operator %>% correctly passes the filtered data to summarise.
Fill both blanks to create a pipe chain that filters and then mutates a new column.
library(dplyr) data <- data.frame(x = 1:5, y = 6:10) result <- data [1] filter(x >= 3) [2] mutate(z = y * 2)
Use %>% to chain both filter and mutate operations.
Fill all three blanks to chain filter, mutate, and then select columns.
library(dplyr) data <- data.frame(x = 1:5, y = 6:10) result <- data [1] filter(x < 5) [2] mutate(z = y + 1) [3] select(x, z)
Use %>% consistently to chain all operations in order.
