Site icon R-bloggers

Wordcloud of conference abstracts – FOSS4G Edinburgh

[This article was first published on R – scottishsnow, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’m helping run a conference this September – FOSS4GUK. To help promote the event I’ve created a wordcloud of conference abstracts, in R!

The conference is taking place in Edinburgh, Scotland at Dynamic Earth. It’s focused on free and open source software for geospatial (FOSS4G), as such is full stack. Everything from backend databases, ETL, analysis to web publication. Tools featured include QGIS, R, Python, PostGIS, leaflet and many others.

Tickets: https://uk.osgeo.org/foss4guk2019/

Follow on twitter: https://twitter.com/foss4guk

Back to the wordcloud. Working with plain text files, I followed Julia and David’s excellent instructions and then added decoration in GIMP. R script below.

<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;">&#65279;</span>
library(tidyverse)
library(tidytext)
library(wordcloud)

# ----------------------------

data("stop_words")

f = list.files("~/dir/dir")
abstracts = lapply(f, function(i){
   read_table(paste0("~/dir/dir/", i),
              col_names = F) %&gt;%
      gather(key, word) %&gt;%
      select(-key) %&gt;%
      add_column(author = str_remove(i, ".txt")) %&gt;%
      unnest_tokens(word, word) %&gt;%
      anti_join(stop_words)
})
abstracts = do.call("rbind.data.frame", abstracts)

png("~/dir/dir/abstract_wordcloud.png",
    width=1200, height=800, res=150)
par(mar = rep(0, 4))
abstracts %&gt;%
   drop_na() %&gt;%
   filter(!str_detect(word, "[0-9]") &amp;
             word != "e.g") %&gt;%
   count(word) %&gt;%
   with(wordcloud(word, n,
                  random.order = FALSE,
                  max.words = 150,
                  colors = c("#497fbf", "#f49835"),
                  rot.per = 0, fixed.asp = F))
dev.off()

To leave a comment for the author, please follow the link and comment on their blog: R – scottishsnow.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.