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: 23 × 3
#>    term                count matches
#>    <chr>               <int>   <dbl>
#>  1 XP                      4       3
#>  2 Product Managers        1       2
#>  3 UI                      8       1
#>  4 Data Science            5       3
#>  5 Decision-Making         3       1
#>  6 Analytical Thinking     4       1
#>  7 Analytical              1       2
#>  8 Business Decisions      8       1
#>  9 Experiments             6       2
#> 10 Analytic Frameworks     2       1
#> # ℹ 13 more rows