hc_dispersion: Plot interactive distributions underlying a dispersion...

View source: R/hc_dispersion.R

hc_dispersionR Documentation

Plot interactive distributions underlying a dispersion analysis

Description

[Experimental]

Compare each query's share of hits with the corpus-token share of each part. The chart uses stored distributions and makes no requests to KorAP.

Usage

hc_dispersion(df, partition = NULL, top = NULL)

Arguments

df

A query-based dispersionAnalysis() or dispersionQuery() result.

partition

Name of one partition in the result. May be omitted when the result contains only one partition. Variants must use the same parts, token sizes, virtual-corpus definitions, KorAP instance and index revision.

top

Number of parts to show individually. NULL (default) shows all calendar years for year/date partitions, and 12 parts otherwise. Parts are ranked by the largest hit share across the variants, with token size breaking ties. Remaining parts are combined into an additional labelled bar group. Inf shows all parts. For year, pubDate and creationDate partitions, displayed four-digit years are ordered chronologically. Dispersion scores are not recalculated.

Details

Percentages use hits and tokens within the listed, positive-sized parts, matching the population used by the dispersion measures. Positive-sized parts without hits are retained. A zero-hit variant has no defined hit-share distribution and is identified in the caption without drawing hit-share bars.

Grey bars show corpus-token shares; coloured bars show the query variants. Tooltips distinguish shares of total frequency from relative frequencies per million tokens, and show absolute frequencies and subcorpus sizes. Click individual variant bars to open their stored concordance links. Corpus-token bars and combined remainder bars have no concordance link.

Sample-based results are labelled as estimates, with inclusion probabilities in tooltips. Page clustering can strongly bias these shares. The chart does not provide confidence intervals or an overall ranking of dispersion scores. The interface and display may change in future releases.

Value

A highchart htmlwidget, customizable with highcharter functions.

Display language

Generated chart text and number formatting follow the browser's preferred German or English language, falling back to English. Query names and custom labels are retained. Set options(rkorap.chart.language = "de") or "en" before creating charts to fix the language for exports; "auto" restores browser selection. IPM means instances per million tokens.

See Also

Other highcharter-helpers: hc_add_onclick_korap_search(), hc_freq_bar_ci(), hc_freq_by_year_ci()

Examples

## Not run: 
d <- KorAPConnection() |>
  corpusQuery(c(star = "[orth='Nutzer*innen']",
                colon = "[orth='Nutzer:innen']")) |>
  fetchSamplePages(maxHits = Inf) |>
  dispersionAnalysis(by = "source")
hc_dispersion(d, top = 12)

## End(Not run)

RKorAPClient documentation built on Nov. 12, 2026, 5:11 p.m.