R/subject_classify.R
subject_classify.Rd
Take a meeting query with subject lines and create a new TRUE/FALSE column which classifies meetings by a provided set of patterns in the subject lines.
subject_classify(
data,
var_name = "class",
keywords = NULL,
pattern = NULL,
ignore_case = FALSE,
return = "data"
)
A Meeting Query dataset in the form of a data frame.
String containing the name of the new column to be created.
Character vector containing the keywords to match.
String to use for regular expression matching instead of
keywords
. When both keywords
and pattern
are supplied, pattern
takes priority and is used instead.
Logical value to determine whether to ignore case when performing pattern matching.
String specifying what output to return.
class_df <-
mt_data %>%
subject_classify(
var_name = "IsSales",
keywords = c("sales", "marketing")
)
#> Using character vector supplied to `keywords`.
#> Returning data frame with additional column: IsSales
class_df %>% dplyr::count(IsSales)
#> # A tibble: 2 × 2
#> IsSales n
#> <lgl> <int>
#> 1 FALSE 1877
#> 2 TRUE 124
# Return a table directly
mt_data %>% subject_classify(pattern = "annual", return = "table")
#> # A tibble: 2 × 2
#> class n
#> <lgl> <int>
#> 1 FALSE 1952
#> 2 TRUE 49