r tibble select rows containing string code example
Example 1: r tibble select rows containing string
dplyr::filter(df, !grepl("RTB",TrackingPixel))
Example 2: using like filter dplyr
library(rbenchmark)
library(tidyverse)
df <- read_csv("Downloads/2008.csv")
print(dim(df))
benchmark(
"str_detect" = {df %>% filter(str_detect(Dest, 'MCO|BWI'))},
"grepl" = {df %>% filter(grepl('MCO|BWI', Dest))},
replications = 10,
columns = c("test", "replications", "elapsed", "relative", "user.self", "sys.self"))