#' @title rSentiment Sentiment Analysis
#' @description Blank Description.
#' @param s NRC Sentiment Data
#' @param n Name
#' @keywords package
#' @return NULL
#' @export
#' @examples sentiment.analysis()
#' sentiment.analysis(nk.tweets, nk.corpus)
sentiment.analysis <- function(d, c) {
if('dplyr' %in% rownames(installed.packages()) == TRUE) {
require(dplyr)} else {
install.packages("dplyr", repos = "http://cran.us.r-project.org")
require(dplyr)}
if('SnowballC' %in% rownames(installed.packages()) == TRUE) {
require(SnowballC)} else {
install.packages("SnowballC", repos = "http://cran.us.r-project.org")
require(SnowballC)}
if('syuzhet' %in% rownames(installed.packages()) == TRUE) {
require(syuzhet)} else {
install.packages("syuzhet", repos = "http://cran.us.r-project.org")
require(syuzhet)}
nk.tweets <- d
nk.corpus <- c
nk.limbo <- cbind(nk.tweets, data.frame(corrected.text = sapply(nk.corpus, identity), stringsAsFactors = FALSE))
nk.sentiment <- syuzhet::get_nrc_sentiment(nk.limbo$corrected.text)
nk.sentiment.flux <- cbind(nk.limbo[, c("created_at", "retweet_count", "favorite_count", "text")], nk.sentiment)
# Set Sentiment Analysis as Global Variable
tweets.sentiment <<- nk.sentiment.flux
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.