Skip to contents

Outputs frequency table of a given dimension

Usage

kwr_dimension_table(x, column)

Arguments

x

A kwresearch object, whose queries are already classified, or a data frame of classified queries (e.g. the result of the kwr_classified_queries function).

column

A dimension (column) as a name, not a string.

Value

A tibble.

Examples

queries <- data.frame(
  query = c("seo", "keyword research"),
  volume = c(1000, 500)
)
kwr <- kwresearch(queries)

recipe_file <- file.path(tempdir(), "my-recipes.yml")
kwr_add_pattern(
  pattern = "seo",
  recipe_file = recipe_file,
  recipe_type = "label",
  dim_name = "my_label"
)
kwr <- kwr_classify(kwr, recipe_file)
#> Label:my_label
kwr_dimension_table(kwr, my_label)
#> # A tibble: 2 × 3
#>   my_label     n volume
#>   <chr>    <int>  <dbl>
#> 1 seo          1   1000
#> 2 NA           1    500

file.remove(recipe_file)
#> [1] TRUE