Loading...
 
Skip to main content

History: Profile_r_test5_wordcloud

Source of version: 9

Copy to clipboard
            Testing some nice graphs from R through Pluginr in Tiki.
^Note for the future: use this new version involving the function  rquery.wordcloud from http://www.sthda.com/english/wiki/word-cloud-generator-in-r-one-killer-function-to-do-everything-you-need . Exxample:
* * http://www.r-bloggers.com/celebrating-one-year-of-blogging-with-a-word-cloud/
^

!! Word-cloud art from mods.t.o

{RR(loadandsave="1", wikisyntax="0", echo="1")}
# Includes a word cloud  with the description of the packages from http://mods.tiki.org
# Example derived from 
# http://www.r-bloggers.com/celebrating-one-year-of-blogging-with-a-word-cloud/
# and 
# http://www.sthda.com/english/wiki/word-cloud-generator-in-r-one-killer-function-to-do-everything-you-need
# 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"
# 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") 
## 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:

{img src=http://doc.tiki.org/display595 imalign=center}

        

History

Information Version
Sat 21 of Nov, 2015 21:40 GMT-0000 Xavier de Pedro cleared the initial description of the source of that code 10
Sat 21 of Nov, 2015 21:38 GMT-0000 Xavier de Pedro adapted to a working example which is simpler in code reusing an external function 9
Sat 21 of Nov, 2015 20:21 GMT-0000 Xavier de Pedro new example and function 8
Fri 31 of May, 2013 10:04 GMT-0000 Xavier de Pedro added echo param 7
Tue 10 of Jul, 2012 14:52 GMT-0000 Xavier de Pedro remove obsolete info line 6
Tue 10 of Jul, 2012 14:51 GMT-0000 Xavier de Pedro added check for preinstalled package 5
Sat 13 of Aug, 2011 18:59 GMT-0000 Xavier de Pedro better without setting the lib location 4
Sat 13 of Aug, 2011 18:19 GMT-0000 Xavier de Pedro added url and path for easier installation of required packages 3
Thu 04 of Aug, 2011 16:29 GMT-0000 Xavier de Pedro typo 2
Thu 04 of Aug, 2011 16:28 GMT-0000 Xavier de Pedro new info 1