Description Usage Arguments Value See Also Examples
Mark words with a class for highlighting.
1 | mark_words(x, words, marks_class, ignore.case = TRUE, ...)
|
x |
A character vector with words to operate on. |
words |
The words to search for. |
marks_class |
The classes to apply to word (must be equal to words in
length). These are dictated by the css generated for marks in
|
ignore.case |
logical. If |
... |
Other arguments passed to |
Returns a character vector with mark tags added around words.
Other mark.functions: mark_regex
,
mark_sentences
,
mark_word_stems
1 2 3 4 5 6 7 8 9 10 11 12 | x <-"I like good cheese but hate Bad cheese"
words <- c("cheese", "like", "good", "bad")
marks_class <- c("neutral", "pos", "pos", "neg")
marks <- c(pos = "lightgreen", neg = "pink", neutral = "yellow")
(body <- mark_words(x, words, marks_class))
## Not run:
## To an external file
template2html(insert_body(highlight_template(marks), body))
open_html()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.