
highlight(x, original.text = NULL, file = "polarity.html", open = TRUE, digits = 3, ...)
sentiment_by
object.sentiment_by
object that is striped of many punctuation marks and
capitalizations.TRUE
the text highlighting document will
attempt to be opened.library(data.table)
dat <- presidential_debates_2012
setDT(dat)
dat[, gr:={gr= paste(person, time); cumsum(c(TRUE, gr[-1]!= gr[-.N]))}]
dat <- dat[, list(person=person[1L], time=time[1L], dialogue=paste(dialogue,
collapse = ' ')), by = gr][,gr:= NULL][]
(sent_dat <- with(dat, sentiment_by(dialogue, list(person, time))))
## Not run:
# highlight(sent_dat)
# highlight(sent_dat, original.text = dat[["dialogue"]])
#
# highlight(with(cannon_reviews, sentiment_by(review, number)))
# ## End(Not run)
Run the code above in your browser using DataLab