Skip to content

Commit

Permalink
Removes examples for non-exported functions (#1091)
Browse files Browse the repository at this point in the history
# Pull Request

Fixes #1084
  • Loading branch information
averissimo authored Feb 7, 2024
1 parent 0249281 commit 30d5720
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 496 deletions.
8 changes: 0 additions & 8 deletions R/include_css_js.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ run_js_files <- function(files) {
#'
#' Simply add `include_teal_css_js()` as one of the UI elements.
#' @return A `shiny.tag.list`.
#' @examples
#' # use non-exported function from teal
#' include_teal_css_js <- getFromNamespace("include_teal_css_js", "teal")
#' shiny_ui <- tagList(
#' include_teal_css_js(),
#' p("Hello")
#' )
#'
#' @keywords internal
include_teal_css_js <- function() {
tagList(
Expand Down
42 changes: 0 additions & 42 deletions R/module_filter_manager.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,6 @@ NULL
#'
#' @name module_filter_manager_modal
#' @inheritParams module_filter_manager
#' @examples
#' # use non-exported function from teal
#' filter_manager_modal_ui <- getFromNamespace("filter_manager_modal_ui", "teal")
#' filter_manager_modal_srv <- getFromNamespace("filter_manager_modal_srv", "teal")
#'
#' fd1 <- teal.slice::init_filtered_data(list(iris = list(dataset = iris)))
#' fd2 <- teal.slice::init_filtered_data(
#' list(iris = list(dataset = iris), mtcars = list(dataset = mtcars))
#' )
#' fd3 <- teal.slice::init_filtered_data(
#' list(iris = list(dataset = iris), women = list(dataset = women))
#' )
#' filter <- teal_slices(
#' teal.slice::teal_slice(dataname = "iris", varname = "Sepal.Length"),
#' teal.slice::teal_slice(dataname = "iris", varname = "Species"),
#' teal.slice::teal_slice(dataname = "mtcars", varname = "mpg"),
#' teal.slice::teal_slice(dataname = "women", varname = "height"),
#' mapping = list(
#' module2 = c("mtcars mpg"),
#' module3 = c("women height"),
#' global_filters = "iris Species"
#' )
#' )
#'
#' ui <- fluidPage(
#' filter_manager_modal_ui("manager")
#' )
#'
#' server <- function(input, output, session) {
#' observe({
#' filter_manager_modal_srv(
#' "manager",
#' filtered_data_list = list(module1 = fd1, module2 = fd2, module3 = fd3),
#' filter = filter
#' )
#' })
#' }
#'
#' if (interactive()) {
#' shinyApp(ui, server)
#' }
#'
#' @keywords internal
#'
NULL
Expand Down
63 changes: 0 additions & 63 deletions R/module_nested_tabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,6 @@
#'
#' `srv_nested_tabs` returns a reactive which returns the active module that corresponds to the selected tab.
#'
#' @examples
#' # use non-exported function from teal
#' include_teal_css_js <- getFromNamespace("include_teal_css_js", "teal")
#' teal_data_to_filtered_data <- getFromNamespace("teal_data_to_filtered_data", "teal")
#' ui_nested_tabs <- getFromNamespace("ui_nested_tabs", "teal")
#' srv_nested_tabs <- getFromNamespace("srv_nested_tabs", "teal")
#'
#' # create `teal_data`
#' data <- teal_data(iris = iris, mtcars = mtcars)
#' datanames <- datanames(data)
#'
#' # creates a hierarchy of `teal_modules` from which a `teal` app can be created.
#' mods <- modules(
#' label = "d1",
#' modules(
#' label = "d2",
#' modules(
#' label = "d3",
#' example_module(label = "aaa1", datanames = datanames),
#' example_module(label = "aaa2", datanames = datanames)
#' ),
#' example_module(label = "bbb", datanames = datanames)
#' ),
#' example_module(label = "ccc", datanames = datanames)
#' )
#'
#' # creates nested list aligned with the module hierarchy created above,
#' # each leaf holding the same `FilteredData` object.
#' datasets <- teal_data_to_filtered_data(data)
#' datasets <- list(
#' "d2" = list(
#' "d3" = list(
#' "aaa1" = datasets,
#' "aaa2" = datasets
#' ),
#' "bbb" = datasets
#' ),
#' "ccc" = datasets
#' )
#'
#' ui <- function() {
#' tagList(
#' include_teal_css_js(),
#' textOutput("info"),
#' fluidPage( # needed for nice tabs
#' ui_nested_tabs("dummy", modules = mods, datasets = datasets)
#' )
#' )
#' }
#' server <- function(input, output, session) {
#' active_module <- srv_nested_tabs(
#' "dummy",
#' datasets = datasets,
#' modules = mods
#' )
#' output$info <- renderText({
#' paste0("The currently active tab name is ", active_module()$label)
#' })
#' }
#' if (interactive()) {
#' shinyApp(ui, server)
#' }
#'
#' @keywords internal
NULL

Expand Down
59 changes: 0 additions & 59 deletions R/module_tabs_with_filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,65 +24,6 @@
#' @return
#' A `shiny.tag.list` containing the main menu, placeholders for filters and placeholders for the `teal` modules.
#'
#' @examples
#' # use non-exported function from teal
#' include_teal_css_js <- getFromNamespace("include_teal_css_js", "teal")
#' teal_data_to_filtered_data <- getFromNamespace("teal_data_to_filtered_data", "teal")
#' ui_tabs_with_filters <- getFromNamespace("ui_tabs_with_filters", "teal")
#' srv_tabs_with_filters <- getFromNamespace("srv_tabs_with_filters", "teal")
#'
#' # creates `teal_data`
#' data <- teal_data(iris = iris, mtcars = mtcars)
#' datanames <- datanames(data)
#'
#' # creates a hierarchy of `teal_modules` from which a `teal` app can be created.
#' mods <- modules(
#' label = "d1",
#' modules(
#' label = "d2",
#' modules(
#' label = "d3",
#' example_module(label = "aaa1", datanames = datanames),
#' example_module(label = "aaa2", datanames = datanames)
#' ),
#' example_module(label = "bbb", datanames = datanames)
#' ),
#' example_module(label = "ccc", datanames = datanames)
#' )
#'
#' # creates nested list aligned with the module hierarchy created above,
#' # each leaf holding the same `FilteredData` object.
#' datasets <- teal_data_to_filtered_data(data)
#' datasets <- list(
#' "d2" = list(
#' "d3" = list(
#' "aaa1" = datasets,
#' "aaa2" = datasets
#' ),
#' "bbb" = datasets
#' ),
#' "ccc" = datasets
#' )
#'
#' ui <- function() {
#' tagList(
#' include_teal_css_js(),
#' textOutput("info"),
#' fluidPage( # needed for nice tabs
#' ui_tabs_with_filters("dummy", modules = mods, datasets = datasets)
#' )
#' )
#' }
#' server <- function(input, output, session) {
#' output$info <- renderText({
#' paste0("The currently active tab name is ", active_module()$label)
#' })
#' active_module <- srv_tabs_with_filters(id = "dummy", datasets = datasets, modules = mods)
#' }
#'
#' if (interactive()) {
#' shinyApp(ui, server)
#' }
#' @keywords internal
#'
NULL
Expand Down
24 changes: 0 additions & 24 deletions R/module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,6 @@
#' @return
#' Returns a `reactive` expression which returns the currently active module.
#'
#' @examples
#' # use non-exported function from teal
#' ui_teal <- getFromNamespace("ui_teal", "teal")
#' srv_teal <- getFromNamespace("srv_teal", "teal")
#'
#' mods <- modules(
#' label = "example app",
#' example_module(label = "example dataset", datanames = c("iris", "mtcars"))
#' )
#'
#' teal_data_rv <- reactive(teal_data(iris = iris, mtcars = mtcars))
#'
#' ui <- function() {
#' ui_teal("dummy")
#' }
#'
#' server <- function(input, output, session) {
#' active_module <- srv_teal(id = "dummy", modules = mods, teal_data_rv = teal_data_rv)
#' }
#'
#' if (interactive()) {
#' shinyApp(ui, server)
#' }
#'
#' @keywords internal
#'
NULL
Expand Down
26 changes: 0 additions & 26 deletions R/modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -391,32 +391,6 @@ is_arg_used <- function(modules, arg) {
#' @param depth optional, integer determining current depth level
#'
#' @return Depth level for given module.
#' @examples
#' # use non-exported function from teal
#' modules_depth <- getFromNamespace("modules_depth", "teal")
#'
#' mods <- modules(
#' label = "d1",
#' modules(
#' label = "d2",
#' modules(
#' label = "d3",
#' module(label = "aaa1"), module(label = "aaa2"), module(label = "aaa3")
#' ),
#' module(label = "bbb")
#' ),
#' module(label = "ccc")
#' )
#' stopifnot(modules_depth(mods) == 3L)
#'
#' mods <- modules(
#' label = "a",
#' modules(
#' label = "b1", module(label = "c")
#' ),
#' module(label = "b2")
#' )
#' stopifnot(modules_depth(mods) == 2L)
#' @keywords internal
modules_depth <- function(modules, depth = 0L) {
checkmate::assert_multi_class(modules, c("teal_module", "teal_modules"))
Expand Down
23 changes: 0 additions & 23 deletions R/teal_slices-store.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@
#'
#' @seealso [teal_slices()]
#'
#' @examples
#' # use non-exported function from teal
#' slices_store <- getFromNamespace("slices_store", "teal")
#'
#' # Create a teal_slices object
#' tss <- teal_slices(
#' teal_slice(dataname = "data", varname = "var"),
#' teal_slice(dataname = "data", expr = "x > 0", id = "positive_x", title = "Positive x")
#' )
#'
#' slices_path <- tempfile(pattern = "teal_slices", fileext = ".json")
#' print(slices_path)
#'
#' # Store the teal_slices object to a file
#' slices_store(tss, slices_path)
#' @keywords internal
#'
slices_store <- function(tss, file) {
Expand All @@ -48,14 +33,6 @@ slices_store <- function(tss, file) {

#' @rdname slices_store
#' @return `slices_restore` returns a `teal_slices` object restored from the file.
#' @examples
#'
#' # use non-exported function from teal
#' slices_restore <- getFromNamespace("slices_restore", "teal")
#'
#' # Restore a teal_slices object from a file
#' tss_restored <- slices_restore(slices_path)
#'
#' @keywords internal
slices_restore <- function(file) {
checkmate::assert_file_exists(file, access = "r", extension = "json")
Expand Down
9 changes: 0 additions & 9 deletions man/include_teal_css_js.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 0 additions & 43 deletions man/module_filter_manager_modal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30d5720

Please sign in to comment.