Skip to contents

Search a data frame column by string

Usage

srchcol(df, col, search, ignore = TRUE, ...)

Arguments

df

<data.frame> or <tibble>

col

column name as string or unquoted

string to search for, can be a regular expression, e.g. '^[A-Z]'

ignore

ignore case, default is TRUE

...

additional arguments

Value

<data.frame> or <tibble>

Examples

x <- dplyr::tibble(y = 1:10, z = letters[1:10])

srchcol(df = x, col = "z", search = "[a|j]")
#> # A tibble: 2 × 2
#>       y z    
#>   <int> <chr>
#> 1     1 a    
#> 2    10 j