Description Usage Arguments Value Examples
Convert tokens into full texts in an HTML file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | create_browser(
tokens,
meta = NULL,
doc_col = "doc_id",
token_col = "token",
space_col = NULL,
doc_nav = NULL,
token_nav = NULL,
filename = NULL,
css_str = NULL,
header = "",
subheader = "",
n = TRUE,
navfilter = TRUE,
top_nav = NULL,
thres_nav = 1,
colors = NULL,
style_col1 = "#7D1935",
style_col2 = "#F5F3EE"
)
|
tokens |
A data.frame with a column for document ids (doc_col) and a column for tokens (token_col) |
meta |
A data.frame with a column for document_ids (doc_col). All other columns are added to the browser as document meta |
doc_col |
The name of the document id column |
token_col |
The name of the token column |
space_col |
Optionally, a column with space indications (" ", "\n", etc.) per token (which is how some NLP parsers indicate spaces) |
doc_nav |
The name of a column (factor or character) in meta, used to create a navigation bar for selecting document groups. |
token_nav |
Alternative to doc_nav, a column in the tokens. Navigation filters will then be used to select documents in which the value occurs at least once. |
filename |
Name of the output file. Default is temp file |
css_str |
A character string, to be directly added to the css style header |
header |
Optionally, specify the header |
subheader |
Optionally, specify a subheader |
n |
If TRUE, report N in header |
navfilter |
If TRUE (default) enable filtering with nav(igation) bar. |
top_nav |
A number. If token_nav is used, navigation filters will only apply to the top x values with highest token occurence in a document |
thres_nav |
Like top_nav, but specifying a threshold for the minimum number of tokens. |
colors |
Optionally, a vector with color names for the navigation bar. Length has to be identical to unique non-NA items in the navigation. |
style_col1 |
Color of the browser header |
style_col2 |
Color of the browser background |
The name of the file where the browser is saved. Can be opened conveniently from within R using browseUrl()
1 2 3 4 5 6 7 8 | url = create_browser(sotu_data$tokens, sotu_data$meta, token_col = 'token', header = 'Speeches')
view_browser(url) ## view browser in the Viewer
if (interactive()) {
browseURL(url) ## view in default webbrowser
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.