compareToResponse | R Documentation |
This function compares the calculated sentiment values with an external response variable. Examples of such an exogenous response are stock market movements or IMDb move rating. Both usually reflect a "true" value that the sentiment should match.
compareToResponse(sentiment, response)
## S3 method for class 'logical'
compareToResponse(sentiment, response)
## S3 method for class 'factor'
compareToResponse(sentiment, response)
## S3 method for class 'integer'
compareToResponse(sentiment, response)
## S3 method for class 'data.frame'
compareToResponse(sentiment, response)
## S3 method for class 'numeric'
compareToResponse(sentiment, response)
sentiment |
Matrix with sentiment scores for each document across several sentiment rules |
response |
Vector with "true" response. This vector can either be of a continuous numeric or binary values. In case of the latter, FALSE is matched to a negative sentiment value, while TRUE is matched to a non-negative one. |
Matrix with different performance metrics for all given sentiment rules
sentiment <- matrix(c(5.5, 2.9, 0.9, -1),
dimnames=list(c("A", "B", "C", "D"), c("Sentiment")))
# continuous numeric response variable
response <- c(5, 3, 1, -1)
compareToResponse(sentiment, response)
# binary response variable
response <- c(TRUE, TRUE, FALSE, FALSE)
compareToResponse(sentiment, response)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.