explore {corporaexplorer} | R Documentation |
Launch Shiny app for exploration of text collection
Description
Launch Shiny app for exploration of text collection. Interrupt R to stop the application (usually by pressing Ctrl+C or Esc).
explore()
explores a 'corporaexplorerobject'
created with the prepare_data()
function.
App settings optionally specified in
the arguments to explore()
.
explore0()
is a convenience function to directly explore
a data frame or character vector
without first creating a corporaexplorerobject using
prepare_data()
, instead creating one on the fly as the app
launches.
Functionally equivalent to
explore(prepare_data(dataset, use_matrix = FALSE))
.
Usage
explore(
corpus_object,
search_options = list(),
ui_options = list(),
search_input = list(),
plot_options = list(),
...
)
explore0(
dataset,
arguments_prepare_data = list(use_matrix = FALSE),
arguments_explore = list()
)
Arguments
corpus_object |
A corporaexplorerobject created by
|
search_options |
List. Specify how search operations in the app are carried out. Available options:
|
ui_options |
List. Specify custom app settings (see example below). Currently available:
|
search_input |
List. Gives the opportunity to pre-populate the following sidebar fields (see example below):
|
plot_options |
List. Specify custom plot settings (see example below). Currently available:
|
... |
Other arguments passed to |
dataset |
Data frame or character vector as specified in |
arguments_prepare_data |
List. Arguments to be passed to
|
arguments_explore |
List. Arguments to be passed to
|
Details
For explore0()
:
by default, no document term matrix will be generated,
meaning that the data will be prepared for exploration faster than
by using the default settings in prepare_data()
,
but also that searches in the app are likely to be slower.
Value
Launches a Shiny app.
Examples
# Constructing test data frame:
dates <- as.Date(paste(2011:2020, 1:10, 21:30, sep = "-"))
texts <- paste0(
"This is a document about ", month.name[1:10], ". ",
"This is not a document about ", rev(month.name[1:10]), "."
)
titles <- paste("Text", 1:10)
test_df <- tibble::tibble(Date = dates, Text = texts, Title = titles)
# Converting to corporaexplorerobject:
corpus <- prepare_data(test_df, corpus_name = "Test corpus")
if(interactive()){
# Running exploration app:
explore(corpus)
explore(corpus,
search_options = list(optional_info = TRUE),
ui_options = list(font_size = "10px"),
search_input = list(search_terms = c("Tottenham", "Spurs")),
plot_options = list(max_docs_in_wall_view = 12001,
colours = c("gray", "green")))
# Running app to extract documents:
run_document_extractor(corpus)
}
if (interactive()) {
explore0(rep(sample(LETTERS), 10))
explore0(rep(sample(LETTERS), 10),
arguments_explore = list(search_input = list(search_terms = "Z"))
)
}