Grep a data frame and return info about the match: where it is, what it is, accessor fields, and other various metadata about the match in question. Not optimized and is currently slow on big datasets or many matches. Further work needs to be done to make this faster/efficient. One of the use case would be to find and replace a pattern wherever it is in the data. Another use case not yet built in is to identify data missingness.

grepdf(df_input, pattern, unique = TRUE, save_df_name = FALSE,
  save_col_name = FALSE, save_pattern = FALSE, tibble = TRUE, ...)

Arguments

df_input

data frame to search

pattern

the literal or regex pattern to search on (default is regex)

unique

return only unique records or all matches?

save_df_name

include the input data frame name in the returned results?

save_col_name

include the matched value column name in the returned results?

save_pattern

include the pattern searched for in the returned results?

tibble

return a tibble? set to FALSE for regular data.frame

...

additional arguments for grep function

See also

grep

Examples

grepdf( df_input = iris , pattern = '3.1|5.9' , unique = FALSE , tibble = FALSE )
#> row_num col_num match #> 1 62 1 5.9 #> 2 71 1 5.9 #> 3 150 1 5.9 #> 4 4 2 3.1 #> 5 10 2 3.1 #> 6 31 2 3.1 #> 7 35 2 3.1 #> 8 53 2 3.1 #> 9 66 2 3.1 #> 10 87 2 3.1 #> 11 138 2 3.1 #> 12 140 2 3.1 #> 13 141 2 3.1 #> 14 142 2 3.1 #> 15 103 3 5.9 #> 16 144 3 5.9