This is a convenience wrapper for tag_tokens() that can be used if tokens only need to be colored.
colorscale_tokens(
tokens,
value,
alpha = 0.4,
class = NULL,
col_range = c("red", "blue"),
unfold = NULL,
span_adjacent = F,
doc_id = NULL
)a character vector of color-tagged tokens
A character vector of tokens
A numeric vector with values between -1 and 1. Determines the color mixture of the scale colors specified in col_range
Optionally, the alpha (transparency) can be specified, with 0 being fully transparent and 1 being fully colored. This can be a vector to specify a different alpha for each value.
Optionally, a character vector of the class to add to the span tags. If NA no class is added
The colors used in the scale ramp.
Either a character vector or a named list of vectors of the same length as tokens. If given, all tokens with a tag can be clicked on to unfold the given text. If a list of vectors is given,
the values of the columns are concatenated with the column name. E.g. list(doc_id = 1, sentence = 1) will be [doc_id = 1, sentence = 2].
This only works if the tagged tokens are used in the html browser created with the create_browser function (as it relies on javascript).
If TRUE, include adjacent tokens with identical attributes within the same tag
If span_adjacent is TRUE, The document ids are required to ensure that tags do not span from one document to another.
colorscale_tokens(c('token_1','token_2','token_3'),
value = c(-1,0,1))
Run the code above in your browser using DataLab