Skip to contents

Gather topic from political discourses

Usage

gather_topics(.data, dictionary = "CAP")

Arguments

.data

A data frame, priorities data frame coded using `select_priorities()`, or text vector. For data frames, function will search for "text" variable. For priorities data frame function will search for "priorities" variable. If missing, opens the webpage containing the political topics codebook.

dictionary

The dictionary of 20 major political topics from the Comparative Agendas Project (Jones et al., 2023) is used by default. Users can also declare a custom dictionary as a vector or a list. If users declare a vector, each element is treated as a independent topic. If users declare a list of subjects and related terms, function understands names as topic and words as terms. For more information on how the CAP topics were adapted, please run `gather_topics()` to access the political topics codebook.

Value

A list of topics present in each text separated by comma.

Examples

# \donttest{
gather_topics(US_News_Conferences_1960_1980[1:5, 3])
#> [1] "Macroeconomics, Civil Rights  Minority Issues  and Civil Liberties, Agriculture, Labor and Employment, Environment and Climate Change, Energy, Immigration, Transportation, Community Development and Housing Issues, Banking  Finance  and Domestic Commerce, Defense, Foreign Trade, International Affairs and Foreign Aid, Government Operations"                                                     
#> [2] "Macroeconomics, Civil Rights  Minority Issues  and Civil Liberties, Health, Labor and Employment, Education, Energy, Immigration, Transportation, Law  Crime  and Family Issues, Community Development and Housing Issues, Banking  Finance  and Domestic Commerce, Defense, Space  Science  Technology  and Communications, Foreign Trade, International Affairs and Foreign Aid, Government Operations"
#> [3] "Macroeconomics, Civil Rights  Minority Issues  and Civil Liberties, Labor and Employment, Immigration, Transportation, Law  Crime  and Family Issues, Banking  Finance  and Domestic Commerce, Defense, International Affairs and Foreign Aid, Government Operations"                                                                                                                                    
#> [4] "Macroeconomics, Health, Agriculture, Labor and Employment, Energy, Immigration, Transportation, Law  Crime  and Family Issues, Community Development and Housing Issues, Banking  Finance  and Domestic Commerce, Defense, Space  Science  Technology  and Communications, Foreign Trade, International Affairs and Foreign Aid, Government Operations, Public Lands and Water Management"               
#> [5] "Macroeconomics, Civil Rights  Minority Issues  and Civil Liberties, Agriculture, Labor and Employment, Energy, Immigration, Law  Crime  and Family Issues, Social Welfare, Community Development and Housing Issues, Banking  Finance  and Domestic Commerce, Defense, Foreign Trade, International Affairs and Foreign Aid, Government Operations"                                                      
#> attr(,"class")
#> [1] "topics"
gather_topics(US_News_Conferences_1960_1980[1:5, 3],
              dictionary = c("military", "development"))
#> [1] "military, development" "military"              "military, development"
#> [4] "military"              "development"          
#> attr(,"class")
#> [1] "topics"
gather_topics(US_News_Conferences_1960_1980[1:5, 3],
              dictionary = list("military" = c("military", "gun", "war"),
                                "development" = c("development", "interest rate", "banks")))
#> [1] "military, development" "military, development" "military, development"
#> [4] "military, development" "development"          
#> attr(,"class")
#> [1] "topics"
#summary(gather_topics(US_News_Conferences_1960_1980[1:5, 3]))
#plot(gather_topics(US_News_Conferences_1960_1980[1:5, 3],
#                   dictionary = c("military", "development")))
# }