Loading...
 

Profile_r_test5_wordcloud

Testing some nice graphs from R through PluginR in Tiki.


Word-cloud art from mods.t.o


{RR(loadandsave="1", wikisyntax="0", echo="1")}
  1. Includes a word cloud with the description of the packages from http://mods.tiki.org
  2. Example derived from
  3. http://www.r-bloggers.com/celebrating-one-year-of-blogging-with-a-word-cloud/
  4. and
  5. http://www.sthda.com/english/wiki/word-cloud-generator-in-r-one-killer-function-to-do-everything-you-need
  6. Former way to do it: http://www.r-bloggers.com/word-cloud-in-r/
if(!require(RCurl)){ install.packages("RCurl", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(SnowballC)){ install.packages("SnowballC", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(XML)){ install.packages("XML", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(tm)){ install.packages("tm", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(wordcloud)){ install.packages("wordcloud", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(RColorBrewer)){ install.packages("RColorBrewer", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
require(RCurl)
require(SnowballC)
require(XML)
require(tm)
require(wordcloud)
require(RColorBrewer)
if (!require("SnowballC")) install.packages("SnowballC")
if (!require("RCurl")) install.packages("RCurl")
source('http://www.sthda.com/upload/rquery_wordcloud.r')
site <-"https://mods.tiki.org"
  1. In the next line, type should be "url", but since this keyword is blocked through Tiki inside plugin content, we bypass Tiki's check with a paste function - paste0("u", "rl") -, and approving the workaround as admin.
res <- rquery.wordcloud(x=site, type=paste0("u", "rl"), min.freq = 8, max.words = 200,
excludeWords=c("three","main","older","see","done"), colorPalette="Dark2")
    1. exclude common words and restrict to words with frequency >= 8, just to get a better picture
{RR}

Once everything is ready in your system (all packages installed, etc), you'll see something like this:

Image