Package 'utilitybeltshiny'

Title: utilitybeltshiny
Description: Assorted utilities for building shiny apps.
Authors: Sam El-Kamand [cre, aut]
Maintainer: Sam El-Kamand <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-10-27 03:04:15 UTC
Source: https://github.com/selkamand/utilitybeltshiny

Help Index


assert_reactive

Description

assert_reactive

Usage

assert_non_reactive(object, msg = "")

Arguments

object

object to test

msg

msg to be appended to the hard-coded default (string)

Value

invisible (TRUE) if expression is TRUE. Will error if is FALSE


assert_reactive

Description

assert_reactive

Usage

assert_reactive(object, msg = "")

Arguments

object

object to test

msg

msg to be appended to the hard-coded default (string)

Value

invisible (TRUE) if expression is TRUE. Will error if is FALSE


Stop App when browser closes

Description

Stops the app running if a user closes their web browser. Useful if distributing your app as a desktop / electron app.

Should be placed in the server function

Usage

close_app_on_browser_exit()

Details

WARNING: Not working ATM


Conditional UI

Description

This function takes some UI element and a compiletime-evaluated expression and returns the UI element ONLY if the condition is true

Usage

conditionalUI(expression, ui_element)

Arguments

expression

compile-time evaluated expression (no server/reactive variables)

ui_element

the UI element to display if

Details

WARNING: Do NOT use this function for runtime-dynamic UI elements. Only works with compiletime variables. For dynamic UI see ?shiny::conditionalPanel()

Value

if expression==TRUE: taglist wrapping passed UI element. If expression == FALSE, empty taglist

Examples

#In UI:
somevariable=TRUE
shinyWidgets::panel(heading="constitutivepanel",
   conditionalUI(somevariable, shinyWidgets::panel(somevariable, heading="ConditionalPanel")),

   shiny::h1("constitutive title"),
   shiny::p("constitutive paragraph")
   )

Download Dataframe

Description

Downloads a dataframe or datatable.

Usage

mod_download_dataframe_server(
  id,
  data_to_write,
  filename_full,
  rownames = FALSE,
  colnames = TRUE
)

Arguments

id

Internal parameters for shiny

data_to_write

dataframe or datatable (dataframe / data.table) (can be a reactive or non-reactive object)

filename_full

Name to save file under. Include any extensions (string)

rownames

Save row names? (boolean)

colnames

Save column names? (boolean)

Value

None, Run for its side effects. Downloads a dataframe/data.table to the local machine.


Download Dataframes

Description

A shiny module that adds a download button to

Usage

mod_download_dataframe_ui(
  id,
  label = "Download",
  tooltip_text = "",
  tooltip_pos = "right",
  style = "unite",
  color = "default",
  size = "sm"
)

Arguments

id

Internal parameters for shiny

label

The label that should appear on the button.

tooltip_text

text to appear when cursor hovers over download button (string)

tooltip_pos

Where the tooltip should appear relative to its target (top, bottom, left, or right). Defaults to "right"

style

Style of the button, to choose between simple, bordered, minimal, stretch, jelly, gradient, fill, material-circle, material-flat, pill, float, unite.

color

Color of the button : default, primary, warning, danger, success, royal.

size

Size of the button : xs,sm, md, lg.


Run the Shiny Application

Description

Run the Shiny Application

Usage

run_app(onStart = NULL, options = list(), enableBookmarking = NULL, ...)

Arguments

onStart

A function that will be called before the app is actually run. This is only needed for shinyAppObj, since in the shinyAppDir case, a global.R file can be used for this purpose.

options

Named options that should be passed to the runApp call (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specify width and height parameters which provide a hint to the embedding environment about the ideal height/width for the app.

enableBookmarking

Can be one of "url", "server", or "disable". The default value, NULL, will respect the setting from any previous calls to enableBookmarking(). See enableBookmarking() for more information on bookmarking your app.

...

arguments to pass to golem_opts