Skip to contents

Count keyword occurrences in a file based on a supplied list.

Usage

count_terms(
  terms,
  counts = NULL,
  doc,
  orderby = c("counts", "doc", "source"),
  filterby = c("both", "count", "matches")
)

See also

Examples

# Load example data
data("example_posting", package = "autocv")
terms <- readLines(autocv_resources("resources/skill_list.txt"))

# Generate some random counts
counts <- sample(0:10, length(prep_term_list(terms)), replace = TRUE)

posting_counts <- count_terms(
  terms = terms,
  counts = counts,
  doc = example_posting,
  orderby = "doc",
  filterby = "both"
)
posting_counts
#> # A tibble: 21 × 3
#>    term                count matches
#>    <chr>               <int>   <dbl>
#>  1 People Analytics        3       1
#>  2 XP                      2       3
#>  3 Product Managers        1       2
#>  4 UI                      9       1
#>  5 Data Science            9       3
#>  6 Decision-Making        10       1
#>  7 Analytical              9       2
#>  8 Business Decisions      3       1
#>  9 Analytic Frameworks     2       1
#> 10 Insights                4       1
#> # ℹ 11 more rows