Q:

Filter rows based on one column from a list of dataframes

I have a list of multiple data frames and I would like to filter these data frames in a list by certain values in one column of each data frame. Each data frame in the list has a column called v1, which has special characters ++, ->, Now I do want to filter only rows having this arrow (->) in each data frame in a list. This is a sample of my dataframes,
dput(df)
df1 <- structure(list(v1 = c("->", "++", "->"),
                      t2 = c("James","Jane", "Egg")),
                 class = "data.frame", row.names = c(NA,  -3L))

dput(df2)
df2 <- structure(list(v1 = c("++", "->", "->"),
                      t2 = c("James","Jane", "Egg")),
                 class = "data.frame", row.names = c(NA,  -3L))
dput(df3)
df3 <- structure(list(v1 = c("++", "++", "->"),
                      t2 = c("James","Jane", "Egg"),
                      d3...c = c("James","Jane", "Egg")),
                 class = "data.frame", row.names = c(NA,  -3L))

I have tried this but I am not getting the dataframes of filtered rows
idx = "->"
dfs <- list(df1,df2,df3)
lapply(dfs, function(x) x$v1 %in% idx)

someone help

A:

idx <- "->"

# Base R
lapply(dfs, function(df) df[df$v1 == "->",])
lapply(dfs, function(df) df[df$v1 %in% idx,])

# tidyverse

library("purrr")
library("dplyr")

map(dfs, filter, v1 == "->")
map(dfs, filter, v1 %in% !! idx)

