[R] Need your favour : twitter sentiment issue while cleaning the corpus

Sandeep Rana sunnysingha.analytics at gmail.com
Tue Feb 16 13:51:26 CET 2016


Hi,
In continuation to my initial mail I also observed that as I include more number of tweets, the likelihood of getting this error increases.

Platform I’m using:
- Mac Yosemite
- R version 3.2.2(RStudio) 

I have below questions:
- Does this error has to do anything with the default locale set in R session? I have had it set from Mac terminal “defaults write org.R-project.R force.LANG en_US.UTF-8” 
- Before creating the Corpus() I had the tweets converted to character by using this command tw_text <- sapply(tw, function(x) x$getText()). Is it the recommended approach ?

How should I go about getting this issue resolved ?

Regards,
Sunny Singha


> On 16-Feb-2016, at 5:22 PM, Sandeep Rana <sunnysingha.analytics at gmail.com> wrote:
> 
> Hi,
> I need your favour. I received below warning while cleaning the corpus of tweets which is not allowing me to further the analysis:
> 
> Warning message:
> In mclapply(content(x), FUN, ...) :
>   scheduled core 1 encountered error in user code, all values of the job will be affected
> 
> Code used: for cleaning. 
> tw_clean <- tm_map(tw_corpus, removePunctuation)
> tw_clean <- tm_map(tw_clean, content_transformer(tolower))
> tw_clean <- tm_map(tw_clean, removeWords, stopwords('english'))
> tw_clean <- tm_map(tw_clean, removeNumbers)
> tw_clean <- tm_map(tw_clean, stripWhitespace)
> 
> Code used to create the corpus:
> tw_corpus <- Corpus(VectorSource(tw_text))
> 
> The error is raised for each of the above line of code. 
> 
> I some how found a way to ignore the error/warning message by including ‘lazy=TRUE’ argument in the tm_map() function
> but when attempted to view the wordcloud(tw_clean)  below error is raised with the same warning.
> 
> Error in UseMethod("meta", x) : 
>   no applicable method for 'meta' applied to an object of class "try-error"
> 
> In addition: Warning message:
> In mclapply(unname(content(x)), termFreq, control) :
>   scheduled core 1 encountered error in user code, all values of the job will be affected
> 
> Regards,
> Sunny Singha


	[[alternative HTML version deleted]]



More information about the R-help mailing list