Reconstructs the hierarchical relations between the three topic variables topics_tier_1
, topics_tier_2
and topics_tier_3
. Can also be used to simply
determine the parent topic(s) of any topic.
Value
A tibble with the columns topic_tier_1
, topic_tier_2
and topic_tier_3
.
See also
Other referendum topic functions:
data_topics
,
hierarchize_topics_fast()
,
infer_topics()
,
topics()
Examples
rdb::hierarchize_topics("territorial questions")
#> topic_tier_1 topic_tier_2 topic_tier_3
#> 1 state organisation federalism territorial questions
# hierarchize the topics of all Austrian referendums
rdb::rfrnds(quiet = TRUE) |>
dplyr::filter(country_code == "AT") |>
dplyr::group_split(id) |>
purrr::map(rdb::hierarchize_topics)
#> [[1]]
#> # A tibble: 2 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation federalism territorial questions
#> 2 state organisation national identity NA
#>
#> [[2]]
#> [1] topic_tier_1 topic_tier_2 topic_tier_3
#> <0 rows> (or 0-length row.names)
#>
#> [[3]]
#> # A tibble: 1 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation national identity NA
#>
#> [[4]]
#> # A tibble: 1 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation national identity NA
#>
#> [[5]]
#> # A tibble: 2 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation federalism territorial questions
#> 2 state organisation national identity NA
#>
#> [[6]]
#> # A tibble: 2 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation federalism territorial questions
#> 2 state organisation national identity NA
#>
#> [[7]]
#> # A tibble: 3 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 state organisation federalism territorial questions
#> 2 state organisation national identity NA
#> 3 state organisation political system NA
#>
#> [[8]]
#> # A tibble: 1 × 3
#> topic_tier_1 topic_tier_2 topic_tier_3
#> <chr> <chr> <chr>
#> 1 energy nuclear energy NA
#>
#> [[9]]
#> topic_tier_1 topic_tier_2 topic_tier_3
#> 1 foreign policy European policy EU
#>
#> [[10]]
#> topic_tier_1 topic_tier_2 topic_tier_3
#> 1 security policy army military organisation
#>
#> [[11]]
#> topic_tier_1 topic_tier_2 topic_tier_3
#> 1 security policy army military organisation
#>