infer_topics: Infer higher-tier topics

infer_topicsR Documentation

Infer higher-tier topics

Description

Determines the top-tier (tier = 1L) or second-tier (tier = 2L) topics corresponding to topics in the hierarchy, i.e. either topics themselves or their (grand)parent topics.

Usage

infer_topics(topics, tier = 1L)

Arguments

topics

Topics from which the corresponding (grand)parent topics are to be determined. A factor or character vector.

tier

Tier of the inferred topics. Either 1L or 2L.

Value

A character vector.

See Also

Other referendum topic functions: data_topics, hierarchize_topics(), hierarchize_topics_fast(), topics()

Examples

rdb::infer_topics(topics = c("EU", "animal protection"),
                  tier = 1L)
rdb::infer_topics(topics = c("EU", "animal protection"),
                  tier = 2L)

# topics of different tiers can mixed in `topics`
rdb::infer_topics(topics = c("EU", "environment"),
                  tier = 2L)

# but `topics` of a higher tier than `tier` will be ignored
rdb::infer_topics(topics = "foreign policy",
                  tier = 2L)

zdaarau/c2d documentation built on Dec. 18, 2024, 1:24 p.m.