crosstab_sdg: Compare query systems and SDGs

Description Usage Arguments Details Value Examples

View source: R/crosstab.R

Description

crosstab_sdg calculates cross tables (aka contingency tables) of SGSs or systems across hits identified via detect_sdg.

Usage

1
crosstab_sdg(hits, compare = c("systems", "sdgs"), systems = NULL, sdgs = NULL)

Arguments

hits

data frame as returned by detect_sdg. Must include columns document, sdg, system, and hit.

compare

character specifying whether systems or SDGs should be cross tabulated.

systems

character vector specifying the query systems to be cross tabulated. Values must be available in the system column of hits. systems of length greater 1 result, by default, in a stacked barplot. Defaults to NULL in which case available values are retrieved from hits.

sdgs

numeric vector with integers between 1 and 17 specifying the SDGs to be cross tabluated. Values must be available in the sdg column of hits. Defaults to NULL in which case available values are retrieved from hits.

Details

crosstab_sdg determines correlations between either query systems or SDGs. The respectively other dimension will be ignored. Note that correlations between SDGs may vary between query systems.

Value

matrix showing correlation coefficients for all pairs of query systems (if compare = "systems") or SDGs (if compare = "SDGs").

Examples

1
2
3
4
5
6
7
8
# run sdg detection
hits <- detect_sdg(projects)

# create cross table of systems
crosstab_sdg(hits)

# create cross table of systems
crosstab_sdg(hits, compare = "sdgs")

psychobas/text2sdg_joss documentation built on Dec. 22, 2021, 9:58 a.m.