piping a vector into all() to test equality
问题 I'm trying to pipe a vector into an all() statement to check if all elements are equal to a certain value. I figure I need to use the exposition pipe %$% since all() does not have a built-in data argument. My attempt leads to an error: library(tidyverse) library(magrittr) vec <- c("a", "b", "a") vec %>% keep(!grepl("b", .)) %$% all(. == "a") #> Error in eval(substitute(expr), data, enclos = parent.frame()): invalid 'envir' argument of type 'character' If I break the pipe before all() and