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"
)

Arguments

data

A Meeting Query dataset in the form of a data frame.

var_name

String containing the name of the new column to be created.

keywords

Character vector containing the keywords to match.

pattern

String to use for regular expression matching instead of keywords. When both keywords and pattern are supplied, pattern takes priority and is used instead.

ignore_case

Logical value to determine whether to ignore case when performing pattern matching.

return

String specifying what output to return.

Examples

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