Skip to contents

Given a dataframe with at least two columns, filter the first two columns at the same time. It uses grepl not equal comparision `==`, so it is possible to use grepl parameters like ignore.case, etc.

Usage

filter_nodes(DF, query, invert = FALSE, ...)

Arguments

DF

Dataframe with at least two columns

query

String to filter the columns

invert

if TRUE, invert the filter. Default FALSE.

...

parameters for grepl

Examples

txt <- "Lorem Ipsum. The Ipsum John. Dolor est Lorem"
DF <- txt |> cooccur_words()
#> tokenizing sentences...
#> tokenizing words...
DF
#> # A tibble: 7 × 3
#>   n1    n2        n
#>   <chr> <chr> <int>
#> 1 dolor est       1
#> 2 dolor lorem     1
#> 3 est   lorem     1
#> 4 ipsum john      1
#> 5 ipsum lorem     1
#> 6 ipsum the       1
#> 7 john  the       1
DF |> filter_nodes("ipsum")
#> # A tibble: 3 × 3
#>   n1    n2        n
#>   <chr> <chr> <int>
#> 1 ipsum john      1
#> 2 ipsum lorem     1
#> 3 ipsum the       1