crosstab_sdg: Compare query systems and SDGs

View source: R/crosstab.R

crosstab_sdgR Documentation

Compare query systems and SDGs

Description

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

Usage

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

Arguments

hits

data frame as returned by detect_sdg_systems. 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. 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


# run sdg detection
hits <- detect_sdg_systems(projects)

# create cross table of systems
crosstab_sdg(hits)

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


text2sdg documentation built on March 31, 2023, 7:22 p.m.