About these slides {.smaller}

Slide with R Output {.smaller}

library(fulltext)
library(polmineR)
ftxt <- corpus("GERMAPARLMINI") %>%
  subset(speaker == "Volker Kauder") %>%
  subset(date == "2009-11-10") %>%
  as.fulltexttable(headline = "Volker Kauder (CDU)", display = "block") %>%
  fulltext(box = TRUE)

Fulltext Output in Slides {.smaller}

library(widgetframe)
knitr::opts_chunk$set(widgetframe_widgetsdir = 'widgets')
frameWidget(ftxt)

Slide with a fulltext widget

frameWidget(ftxt)

Fulltext likes compancy {.smaller}

Scenario & Code, Part I {.smaller}

speeches <- corpus("GERMAPARLMINI") %>%
  subset(date == "2009-11-10") %>%
  as.speeches(s_attribute_name = "speaker", verbose = FALSE, progress = FALSE)
speeches <- speeches[[subset(summary(speeches), size >= 50)$name]]
df_list <- lapply(seq_len(length(speeches)),
  function(i) data.frame(
    as.fulltexttable(speeches[[i]], headline = unname(name(speeches[[i]])), display = "none", name = name(name(speeches[[i]]))),
    subcorpus_id = unname(name(speeches[[i]])))
  )
df <- do.call(rbind, df_list)

Scenario & Code, Part II {.smaller}

library(crosstalk)
sd <- crosstalk::SharedData$new(df, ~subcorpus_id, group = "fulltext")
speeches_table <- data.frame(name = names(speeches))
dt_cross <- crosstalk::SharedData$new(speeches_table, ~name, group = "fulltext")

Putting it together (Part III) {.smaller}

y <- bscols(
  widths = c(5,NA),
  DT::datatable(
    dt_cross,
    options = list(lengthChange = TRUE, pageLength = 8L, pagingType = "simple", dom = "tp"),
    rownames = NULL, width = "100%", selection = "single"
  ),
  fulltext(sd, width = "100%", box = FALSE)
)
crosstalk_html <- file.path(getwd(), "crosstalk.html")
htmltools::save_html(y, file = crosstalk_html, background = "white",  libdir = "lib")

A fulltext selection slide {.smaller}

Managing resulting files {.smaller}

Summary & Next Steps {.smaller}



PolMine/annolite documentation built on Dec. 31, 2020, 4:18 p.m.