# NOT RUN {
data_corpus_inauguralPost70 <- corpus_subset(data_corpus_inaugural, Year > 1970)
# compare multiple documents
textplot_xray(kwic(data_corpus_inauguralPost70, "american"))
textplot_xray(kwic(data_corpus_inauguralPost70, "american"), scale = "absolute")
# compare multiple terms across multiple documents
textplot_xray(kwic(data_corpus_inauguralPost70, "america*"),
kwic(data_corpus_inauguralPost70, "people"))
# how to modify the ggplot with different options
library(ggplot2)
g <- textplot_xray(kwic(data_corpus_inauguralPost70, "american"),
kwic(data_corpus_inauguralPost70, "people"))
g + aes(color = keyword) + scale_color_manual(values = c('red', 'blue'))
# adjust the names of the document names
docnames(data_corpus_inauguralPost70) <- apply(docvars(data_corpus_inauguralPost70,
c("Year", "President")),
1, paste, collapse = ", ")
textplot_xray(kwic(data_corpus_inauguralPost70, "america*"),
kwic(data_corpus_inauguralPost70, "people"))
# }
Run the code above in your browser using DataLab