Last active
August 23, 2017 15:56
-
-
Save cbonsig/d0b569bb5e510dcabe6ed02e924b1025 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages("tm") | |
install.packages("SnowballC") | |
install.packages("wordcloud") | |
install.packages("readtext") | |
library(tm) | |
library(SnowballC) | |
library(wordcloud) | |
library(readtext) | |
getwd() | |
setwd('/Users/cbonsignore/Desktop/Karthik Documents') | |
wordbase <- readtext("*.pdf") | |
corp <- Corpus(VectorSource(wordbase)) | |
corp <- tm_map(corp, removePunctuation) | |
corp <- tm_map(corp, removeNumbers) | |
corp <- tm_map(corp, removeWords, c('the', 'this', 'and', 'page', | |
stopwords('english'))) | |
color <- rev(brewer.pal(8,"RdYlBu")) | |
wordcloud(corp, max.words = 250, | |
random.order = FALSE, colors = color, | |
family = "serif", font = 3, | |
scale = c(3,0.75)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment