# Text of the books downloaded from:
# A Mid Summer Night's Dream:
# http://www.gutenberg.org/cache/epub/2242/pg2242.txt
# The Merchant of Venice:
# http://www.gutenberg.org/cache/epub/2243/pg2243.txt
# Romeo and Juliet:
# http://www.gutenberg.org/cache/epub/1112/pg1112.txt
function(input, output, session) {
# Define a reactive expression for the document term matrix
terms <- reactive({
# Change when the "update" button is pressed...
input$update
# ...but not for anything else
isolate({
withProgress({
setProgress(message = "Processing corpus...")
getTermMatrix(input$selection)
})
})
})
# Make the wordcloud drawing predictable during a session
wordcloud_rep <- repeatable(wordcloud)
output$plot <- renderPlot({
v <- terms()
wordcloud_rep(names(v), v, scale=c(4,0.5),
min.freq = input$freq, max.words=input$max,
colors=brewer.pal(8, "Dark2"))
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.