View source: R/FilterState-utils.R
init_filter_state | R Documentation |
FilterState
Initializes a FilterState
object corresponding to the class of the filtered variable.
init_filter_state(
x,
x_reactive = reactive(NULL),
slice,
extract_type = character(0)
)
x |
( |
x_reactive |
( |
slice |
( |
extract_type |
(
|
FilterState
object
# use non-exported function from teal.slice
init_filter_state <- getFromNamespace("init_filter_state", "teal.slice")
library(shiny)
filter_state <- init_filter_state(
x = c(1:10, NA, Inf),
x_reactive = reactive(c(1:10, NA, Inf)),
slice = teal_slice(
varname = "varname",
dataname = "dataname"
),
extract_type = "matrix"
)
isolate(filter_state$get_call())
# working filter in an app
ui <- fluidPage(
filter_state$ui(id = "app"),
verbatimTextOutput("call")
)
server <- function(input, output, session) {
filter_state$server("app")
output$call <- renderText(
deparse1(filter_state$get_call(), collapse = "\n")
)
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.