hc_freq_by_year_ci {RKorAPClient}R Documentation

Plot interactive frequency curves with confidence intervals

Description

[Experimental]

Convenience function for plotting typical frequency by year graphs with confidence intervals using highcharter.

Warning: This function may be moved to a new package.

Usage

hc_freq_by_year_ci(
  df,
  as.alternatives = FALSE,
  ylabel = if (as.alternatives) "%" else "ipm",
  smooth = FALSE,
  ...
)

Arguments

df

data frame like the value of a frequencyQuery()

as.alternatives

boolean decides whether queries should be treated as mutually exclusive and exhaustive wrt. to some meaningful class (e.g. spelling variants of a certain word form).

ylabel

defaults to ⁠%⁠ if as.alternatives is TRUE and to ipm otherwise.

smooth

boolean decides whether the graph is smoothed using the highcharts plot types spline and areasplinerange.

...

additional arguments passed to hc_add_series()

Value

A highchart htmlwidget object containing the frequency plot.

See Also

Other highcharter-helpers: hc_add_onclick_korap_search()

Examples

## Not run: 

year <- c(1990:2018)
alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
new("KorAPConnection", verbose = TRUE) %>%
  frequencyQuery(query = alternatives,
                 vc = paste("textType = /Zeit.*/ & pubDate in", year),
                 as.alternatives = TRUE) %>%
  hc_freq_by_year_ci(as.alternatives = TRUE)


kco <- new("KorAPConnection", verbose = TRUE)
expand_grid(
  condition = c("textDomain = /Wirtschaft.*/", "textDomain != /Wirtschaft.*/"),
  year = (2005:2011)
) %>%
  cbind(frequencyQuery(
    kco,
    "[tt/l=Heuschrecke]",
    paste0(.$condition, " & pubDate in ", .$year)
  ))  %>%
  hc_freq_by_year_ci()

## End(Not run)


[Package RKorAPClient version 0.8.1 Index]