Learn R Programming

RKorAPClient (version 0.5.9)

hc_freq_by_year_ci: Experimental: Plot interactive frequency by year graphs with confidence intervals using highcharter

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

Examples

Run this code
# NOT RUN {
year <- c(1990:2018)
# }
# NOT RUN {
alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
# }
# NOT RUN {
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)

# }
# NOT RUN {
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()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab