Formatting data extracts
format_data_extract.Rd
Returns a human-readable string representation of an extracted data_extract_spec
object.
Details
This function formats the output of data_extract_srv
. See the example for more information.
Examples
simple_des <- data_extract_spec(
dataname = "iris",
filter = filter_spec(vars = "Petal.Length", choices = c("1.4", "1.5")),
select = select_spec(choices = c("Petal.Length", "Species"))
)
sample_filtered_data <- {
teal.slice::init_filtered_data(
list(iris = list(dataset = iris))
)
}
if (interactive()) {
shiny::shinyApp(
ui = shiny::fluidPage(
data_extract_ui(
id = "extract",
label = "data extract ui",
data_extract_spec = simple_des,
is_single_dataset = TRUE
),
shiny::verbatimTextOutput("formatted_extract")
),
server = function(input, output, session) {
extracted_input <- data_extract_srv(
id = "extract",
datasets = sample_filtered_data,
data_extract_spec = simple_des
)
output$formatted_extract <- shiny::renderPrint({
cat(format_data_extract(extracted_input()))
})
}
)
}