Hi, I can't execute my R code in SAP analytics, anyone can help debug my code
library("NLP")
library("tm")
library("SnowballC")
library("RColorBrewer")
library("wordcloud")
library("dplyr")
###############################
### ###
###############################
Unaccent <- function(texte) {
texte <- gsub("['`^~\"]", " ", texte) %>%
iconv(to="ASCII//TRANSLIT//IGNORE")
texte <- gsub("['`^~\"]", "", texte)
}
removeAccents = function(phrase){
phrase <- gsub(phrase, pattern = "\303\203\302\251", replacement = "e") %>%
gsub(pattern = "\303\203\302\251", replacement = "e") %>%
gsub(pattern = "\303\203\302\240\303\202\302\240", replacement = "a") %>%
gsub(pattern = "\303\203\302\240\303\202\302\242", replacement = "a") %>%
gsub(pattern = "\303\203\302\247", replacement = "c") %>%
gsub(pattern = "\303\203\302\252", replacement = "e") %>%
gsub(pattern = "\303\203\302\250", replacement = "e") %>%
gsub(pattern = "\303\203\302\240\303\202\302\271", replacement = "u") %>%
gsub(pattern = "\303\203\302\202\303\202\302\262", replacement = "") %>%
gsub(pattern = "\303\203\302\256", replacement = "i") %>%
gsub(pattern = "\303\203\302\264", replacement = "o") %>%
gsub(pattern = "\303\203\302\202\303\202\302\253", replacement = "") %>%
gsub(pattern = "\342\200\231\303\251", replacement = "e") %>%
gsub(pattern = "\303\251", replacement = "e") %>%
gsub(pattern = "\342\200\231", replacement = " ") %>%
gsub(pattern = "\303\250", replacement = "e") %>%
gsub(pattern = "\303\247", replacement = "c") %>%
gsub(pattern = "\303\264", replacement = "o") %>%
gsub(pattern = "\303\240", replacement = "a") %>%
gsub(pattern = "\303\242", replacement = "a") %>%
gsub(pattern = "\305\223", replacement = "oe") %>%
gsub(pattern = "\303\252", replacement = "e") %>%
gsub(pattern = "\303\211", replacement = "E") %>%
gsub(pattern = "\303\203\302\273", replacement = "u")
}
######################################
### ###
######################################
text <- Connect_X %>%
data.frame()
vecteurdocs <- Unaccent(removeAccents(text[,1]))
docs <- Corpus(VectorSource(vecteurdocs)) %>%
tm_map(content_transformer(tolower)) %>%
tm_map(removeNumbers) %>%
tm_map(removeWords, stopwords("french")) %>%
tm_map(removePunctuation) %>%
tm_map(stripWhitespace)
set.seed(1234)
################################
## ###
################################
wordcloud(docs, min.freq = 100,
max.words=Calculation_Input_1, random.order=FALSE, rot.per=0,
colors=brewer.pal(8, "Dark2"))