grepdf: Grep a dataframe: many synergy, much useful, wow

Description Usage Arguments See Also Examples

View source: R/grepdf.R

Description

Grep a dataframe and return a dataframe 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 cases 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.

Usage

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

Arguments

df_input

data.frame; required; dataframe to search

pattern

scalar; required; the regex or literal pattern to search on (uses regex pattern unless fixed = TRUE is passed as a function parameter, see examples)

unique

logical; default is TRUE; return only unique records or all matches?

save_df_name

logical; default is FALSE; include the input dataframe name in the returned results?

save_col_name

logical; default is FALSE; include the matched value column name in the returned results?

save_pattern

logical; default is FALSE; include the pattern searched for in the returned results?

...

additional arguments passed to grep

See Also

grep

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
grepdf(
    df_input = iris
  , pattern  = '3[.]1|5[.]9'
  , unique   = FALSE
)

grepdf(
    df_input = esoph
  , pattern  = '0-9g/day'
  , unique   = FALSE
  , fixed    = TRUE
)

Paul-James/pjames documentation built on Aug. 9, 2019, 12:18 p.m.