[datatable-help] non-numeric argument to binary operator -R

leebrimlow memedede379 at gmail.com
Mon Nov 13 14:44:09 CET 2017


I have this code :

dataset <- maml.mapInputPort(1)

library(tm) ## Text mining library

## Set the comlumn names
colnames(dataset) <- c("sentiment", "tweets")

## Extract text data and coerce the vector to a tm corpus
tweet.text<- Corpus(VectorSource(dataset['tweets'])) 

## Apply transformations to the corpus
tweet.text<- tm_map(tweet.text, content_transformer(removeNumbers))
tweet.text<- tm_map(tweet.text, content_transformer(removePunctuation))
tweet.text<- tm_map(tweet.text, content_transformer(stripWhitespace))
tweet.text<- tm_map(tweet.text, content_transformer(tolower))

## Transform the processed corpus back to a vector of 
## character strings in a dataframe
tweet_content<- unlist(sapply(tweet.text, '[', "content"))
outframe <- data.frame(tweets = enc2utf8(tweet_content), 
                       sentiment =dataset$sentiment / as.numeric(2 - 1),
stringsAsFactors = F,
row.names = NULL)

## Output the result
maml.mapOutputPort("outframe")
Error message is:

requestId = 4291be2aafb34195b285d9a930804d81 errorComponent=Module.
taskStatusCode=400.
{"Exception":{"ErrorId":"FailedToEvaluateRScript","ErrorCode":"0063","ExceptionType":"ModuleException","Message":"Error
0063: The following error occurred during evaluation of R
script:\r\n---------- Start of error message from R
----------\r\nnon-numeric argument to binary operator\r\n\r\n\r\nnon-numeric
argument to binary operator\r\n----------- End of error message from R
-----------"}}Error: Error 0063: The following error occurred during
evaluation of R script:---------- Start of error message from R
----------non-numeric argument to binary operatornon-numeric argument to
binary operator----------- End of error message from R ----------- Process
exited with error code -2


Any help please!



--
Sent from: http://r.789695.n4.nabble.com/datatable-help-f2315188.html


More information about the datatable-help mailing list