History: Profile_r_test5_wordcloud
Source of version: 7
Copy to clipboard
Testing some nice graphs from R through Pluginr in Tiki. !! 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 adapted from the ones shown here: http://www.r-bloggers.com/word-cloud-in-r/ 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(XML) require(tm) require(wordcloud) require(RColorBrewer) u2 = "http://mods.tiki.org/" t2 = readHTMLTable(u2) ap.corpus2 <- Corpus(DataframeSource(data.frame(t2[[1]][6]))) ap.corpus2 <- tm_map(ap.corpus2, removePunctuation) ap.corpus2 <- tm_map(ap.corpus2, tolower) ap.corpus2 <- tm_map(ap.corpus2, function(x) removeWords(x, stopwords("english"))) ap.tdm2 <- TermDocumentMatrix(ap.corpus2) ap.m2 <- as.matrix(ap.tdm2) ap.v2 <- sort(rowSums(ap.m2),decreasing=TRUE) ap.d2 <- data.frame(word = names(ap.v2),freq=ap.v2) #table(ap.d2$freq) pal2 <- brewer.pal(8,"Dark2") #png("wordcloud_packages.png", width=1280,height=800) wordcloud(ap.d2$word,ap.d2$freq, scale=c(8,.2),min.freq=3, max.words=Inf, random.order=FALSE, rot.per=.15, colors=pal2) #dev.off() {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}