Title: | 'shiny' Info |
---|---|
Description: | Displays simple diagnostic information of the 'shiny' project in the user interface of the app. |
Authors: | Paweł Przytuła [aut], Dominik Krzemiński [aut], Jakub Nowicki [aut, cre], Appsilon Sp. z o.o. [cph] |
Maintainer: | Jakub Nowicki <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0.9000 |
Built: | 2024-09-15 04:16:17 UTC |
Source: | https://github.com/appsilon/shiny.info |
Displays a spinner indicating if there are any calculations running on the server side.
busy(loader = "dots", position = "top right")
busy(loader = "dots", position = "top right")
loader |
character or list. If character given, then it selects from one of a few
available loaders (look Details for more). By using list you can create your custom loder.
List needs to have structure |
position |
character with position of the parameter. Default "top right". |
Currently available loaders: "dots", "spinner".
Solution inspired by: https://colinfay.me/watch-r-shiny/.
shiny tag List with js script, style of spinner and display div
Display message on the top-right corner
display(message, position = "top right", type = "message")
display(message, position = "top right", type = "message")
message |
character with any message you want |
position |
character with position of the parameter. Default "top right". |
type |
character with display type to specify the id. Default to "message" |
div which wraps your message to display it in the position corner of your shiny app.
Displays git information from the repository of the current working space.
git_info(position = "top right")
git_info(position = "top right")
position |
character with position of the parameter. Default "top right". |
Creates a panel for all info boxes so they do not overlap
info_panel(..., position = "top right")
info_panel(..., position = "top right")
... |
calls with info elements |
position |
character with position of the parameter. Default "top right". |
div which wraps your all info boxes to display it in the position corner of your shiny app.
UI output for info value
info_value(id, position = "top right")
info_value(id, position = "top right")
id |
output id to render |
position |
character with position of the parameter. Default "top right". |
div which wraps rendered value to display it in the position corner of your shiny app.
Wrapper for info_panel function
infoPanel(..., position = "top right")
infoPanel(..., position = "top right")
... |
calls with info elements |
position |
character with position of the parameter. Default "top right". |
div which wraps your all info boxes to display it in the position corner of your shiny app.
Helps to easlily stop app at any moment for debugging or checking state.
inspect_btn_server(input)
inspect_btn_server(input)
input |
Shiny server input. |
observeEvent for Inspect button
Helps to easlily stop app at any moment for debugging or checking state.
inspect_btn_ui(label = "Inspect", position = "top right")
inspect_btn_ui(label = "Inspect", position = "top right")
label |
label for debug button. Default "Inspect" |
position |
character with position of the parameter. Default "top right". |
div with "shinyinfo_inspect_btn".
Displays information about authors of the shiny app.
powered_by( company_name = NULL, link = "#", position = "top right", logo = NULL, logo_width = "120px", logo_height = "auto", inline = FALSE )
powered_by( company_name = NULL, link = "#", position = "top right", logo = NULL, logo_width = "120px", logo_height = "auto", inline = FALSE )
company_name |
character with the creator of the app |
link |
link to the creator's website |
position |
character with position of the parameter. Default "top right". |
logo |
web link to a logo image or name of the image file in ./www |
logo_width |
width of the logo in pixels |
logo_height |
height of the logo in pixels |
inline |
if TRUE, display text and logo on the same line |
div with "powered by".
Server render function for info value
render_info_value( expr, env = parent.frame(), quoted = FALSE, sep = " ", add_name = TRUE )
render_info_value( expr, env = parent.frame(), quoted = FALSE, sep = " ", add_name = TRUE )
expr |
value to render |
env |
The environment in which to evaluate expr. Default parent.frame() |
quoted |
Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable. Default FALSE |
sep |
A separator passed to cat to be appended after each element. |
add_name |
Should expression name be added. Default TRUE |
If you want to use it with toggle_info(), you have to add outputOptions(output, [info value id], suspendWhenHidden = FALSE) to force rendering when the value is hidden.
Shiny render function to be saved as an element of output.
if(interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( info_value("value_to_display") ) server <- function(input, output, session) { test_reactive <- reactiveVal("some value") output$value_to_display <- render_info_value(expr = test_reactive()) # next line is required to work with toggle_info() outputOptions(output, "value_to_display", suspendWhenHidden = FALSE) } }
if(interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( info_value("value_to_display") ) server <- function(input, output, session) { test_reactive <- reactiveVal("some value") output$value_to_display <- render_info_value(expr = test_reactive()) # next line is required to work with toggle_info() outputOptions(output, "value_to_display", suspendWhenHidden = FALSE) } }
Server render function for rendering informations about user session (app URL, username and pixel ratio)
render_session_info()
render_session_info()
Use it with info_value UI function. If you want to use it with toggle_info(), you have to add outputOptions(output, [session info id], suspendWhenHidden = FALSE) to force rendering when the value is hidden.
Shiny render function to be saved as an element of output.
if(interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( info_value("session_info") ) server <- function(input, output, session) { outputsession_info <- render_session_info() # next line is required to work with toggle_info() outputOptions(output, "session_info", suspendWhenHidden = FALSE) } }
if(interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( info_value("session_info") ) server <- function(input, output, session) { outputsession_info <- render_session_info() # next line is required to work with toggle_info() outputOptions(output, "session_info", suspendWhenHidden = FALSE) } }
Toggle showing info with keyboard shortcut
toggle_info(shortcut = "Ctrl+Shift+K", hidden_on_start = TRUE)
toggle_info(shortcut = "Ctrl+Shift+K", hidden_on_start = TRUE)
shortcut |
keys that trigger showing info. Shortcut can include special keys: Ctrl, Alt, Shift. Keys should be separated with '+' sign. Default Ctrl+Shift+K |
should info panels be hidden on start of the application? Default TRUE. |
toggle_info() should be added in the header of the application in ui.R, since it adds a script with toggle functionality. If you want to use it with info_value, you have to add outputOptions(output, [info value id], suspendWhenHidden = FALSE) to force rendering when the value is hidden.
JS script that adds toggle functionality.
if (interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( toggle_info(), shiny.info::display("test message"), shiny.info::info_value("test_input_value", "bottom right"), textInput(inputId = "test_input", label = NULL) ) server <- function(input, output, session) { output$test_input_value <- shiny.info::render_info_value(input$test_input) outputOptions(output, "test_input_value", suspendWhenHidden = FALSE) } shinyApp(ui = ui, server = server) }
if (interactive()) { library(shiny) library(shiny.info) ui <- fluidPage( toggle_info(), shiny.info::display("test message"), shiny.info::info_value("test_input_value", "bottom right"), textInput(inputId = "test_input", label = NULL) ) server <- function(input, output, session) { output$test_input_value <- shiny.info::render_info_value(input$test_input) outputOptions(output, "test_input_value", suspendWhenHidden = FALSE) } shinyApp(ui = ui, server = server) }
Displays the version of the app by default using VERSION global variable.
version(ver = NULL, position = "top right")
version(ver = NULL, position = "top right")
ver |
(default NULL) custom version number |
position |
character with position of the parameter. Default "top right". |
version() # if VERSION global variable exists version("1.2.1") # with custom version number
version() # if VERSION global variable exists version("1.2.1") # with custom version number