Last active
May 22, 2017 22:33
-
-
Save marceloreis/ab5c08ba51aa6164a4cf3b0a6b57286a 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
library(Rfacebook) | |
library(tm) | |
library(wordcloud) | |
fbtoken = "use_seu_token" # Favor substituir por token de usuario (temporario) gerado pela API do Facebook | |
# Obtenha seu token em https://developers.facebook.com/tools/accesstoken/ | |
rbrp <- searchGroup(name="R Brasil Programadores", token=fbtoken) | |
rbrp_i <- getGroup(rbrp[1,3],token=fbtoken,n=200) | |
posts <- iconv(rbrp_i[,3],to="UTF-8") | |
posts_corpus = SimpleCorpus(VectorSource(posts),control=list(language="pt")) | |
posts_corpus = tm_map(posts_corpus,removePunctuation) | |
posts_corpus = tm_map(posts_corpus, content_transformer(tolower)) | |
posts_corpus = tm_map(posts_corpus,removeWords,stopwords("pt")) | |
posts_corpus = tm_map(posts_corpus,removeWords,stopwords("en")) | |
png("./rbrasilprogramadores.png",width = 900,height=900) | |
wordcloud(posts_corpus,colors=brewer.pal(7,"Set2"),min.freq=2,max.words=300,scale = c(7,.5)) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment