| Title: | Lares 'shiny' Modules |
|---|---|
| Description: | Useful 'shiny' production-ready modules and helpers such as login window and visualization tools. |
| Authors: | Bernardo Lares [cre, aut] |
| Maintainer: | Bernardo Lares <[email protected]> |
| License: | AGPL-3 |
| Version: | 0.0.4.9001 |
| Built: | 2026-05-14 08:37:55 UTC |
| Source: | https://github.com/laresbernardo/lareshiny |
This function automatically adapts the length of a title or subtitle text so that it wraps long texts in separate lines. This is useful to avoid trimming long texts when the rendered shiny size is shorter.
autoline_shiny(session, text, plot_name, font_size = 14, n = 1.6)autoline_shiny(session, text, plot_name, font_size = 14, n = 1.6)
session |
Shiny's session object. |
text |
Character. Text for the title or subtitle or any text to be wrapped. |
plot_name |
Character. The name of the output plot. |
font_size, n
|
Numeric. Values to help calculate a proxy of length. |
Character. String with wrapped values.
This function personalizes your Shiny dashboard's header with logo, links, favicon, font, and texts.
custom_header( title = "MyLareShiny", site = NULL, favicon = NULL, font = "Montserrat", logosrc = NULL, logo_height = "40px", logo_width = NULL, loadingsrc = NULL, load_height = "40px", load_width = NULL, text = Sys.Date(), type = 1 )custom_header( title = "MyLareShiny", site = NULL, favicon = NULL, font = "Montserrat", logosrc = NULL, logo_height = "40px", logo_width = NULL, loadingsrc = NULL, load_height = "40px", load_width = NULL, text = Sys.Date(), type = 1 )
title |
Character. Your 'shiny' app title (displayed in Navigators' tab) |
site |
Character. URL for your site (opens when logo is clicked) |
favicon |
Character. Image for your favicon.
Save file in |
font |
Character. Font for whole 'shiny' app. Use Google Fonts names. |
logosrc, loadingsrc
|
Character. Logo image and loading image. For
local files, save them in |
logo_height, logo_width, load_height, load_width
|
Integer. Logo and loading images dimensions. |
text |
Character. Text displayed in top right corner. |
type |
Integer. 1 for complete |
A dashboardHeader object.
if (interactive()) { shinyApp( ui = dashboardPage( custom_header( title = "MyLareShiny", site = "https://github.com/laresbernardo/lareshiny", font = "Montserrat", logosrc = "logo.png", text = Sys.Date() ), dashboardSidebar(disable = TRUE), dashboardBody() ), server = function(input, output) { } ) }if (interactive()) { shinyApp( ui = dashboardPage( custom_header( title = "MyLareShiny", site = "https://github.com/laresbernardo/lareshiny", font = "Montserrat", logosrc = "logo.png", text = Sys.Date() ), dashboardSidebar(disable = TRUE), dashboardBody() ), server = function(input, output) { } ) }
Totals Row for datatables
js_op(column, operation, txt = "", signif = 3)js_op(column, operation, txt = "", signif = 3)
column |
Integer. Starting from 0, which column to operate |
operation |
Character. Select from sum, mean, count, custom |
txt |
Character. Insert text before (or instead) operation |
signif |
Integer. How many decimals to consider when operating |
Text that can be parsed as javascript.
Helper for javascript code
js_op_aux(type, df = NULL)js_op_aux(type, df = NULL)
type |
Character. Select start, end or sketch. |
df |
data.frame. Needed for sketch only. |
Text that can be parsed as javascript.
R library for quick useful Shiny modules
Bernardo Lares ([email protected])
Useful links:
Report bugs at https://github.com/laresbernardo/lareshiny/issues
Friendly app that helps you export lares' h2o_automl() results
model_exporter(model)model_exporter(model)
model |
List. Result from h2o_automl() |
A shiny interactive app
if (interactive()) { model_exporter(model) }if (interactive()) { model_exporter(model) }
Login Module for Shiny with local User and Password. This must be added in the server section (no need to add UI)
module_login( input, session, users = c("123", "321"), pwds = c("123", "321"), logo = NA, logo_height = "100px", lang = "es", style = list(botton_txt_colour = "#FFFFFF", botton_bgd_colour = "#EBB600"), change_text = list(), logged = FALSE, personal = "MacBookBLB.local" )module_login( input, session, users = c("123", "321"), pwds = c("123", "321"), logo = NA, logo_height = "100px", lang = "es", style = list(botton_txt_colour = "#FFFFFF", botton_bgd_colour = "#EBB600"), change_text = list(), logged = FALSE, personal = "MacBookBLB.local" )
input, session
|
Shiny's input and session objects. |
users, pwds
|
Character Vector. User and password combinations accepted |
logo |
Character. Select image for logo display. Host local file in your www directory preferably |
logo_height |
Character. Height for rendering the logo. |
lang |
Character. Language. Currently accepted: es, en |
style |
List. Possible values for styling the module such as
|
change_text |
Named list. Change the default texts used. |
logged |
Boolean. You might want to set to TRUE when developing or testing your app so this module doesn't show up every time. Check the personal parameter as well |
personal |
Character vector. If you wish to auto-login certain
user(s), set the values from |
A reactiveValues object
if (interactive()) { ui <- fluidPage("Hello lareshiny!") server <- function(input, output, session) { login <- module_login(input, session, personal = "") observe({ if (login$authenticated) message("User logged in successfully: ", login$user) }) } shinyApp(ui, server) }if (interactive()) { ui <- fluidPage("Hello lareshiny!") server <- function(input, output, session) { login <- module_login(input, session, personal = "") observe({ if (login$authenticated) message("User logged in successfully: ", login$user) }) } shinyApp(ui, server) }