knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
# Required packages
pkgs <- c("shiny")
# write to vignette
knitr::write_bib(pkgs, fs::path("vignettes", "packages.bib"), prefix = "")
# book entry
hadley <- bibentry(
  key = "Wickham2020",
  bibtype = "Book",
  title = "Mastering Shiny: Build Interactive Apps, Reports, and Dashboards Powered by R",
  author =  person("Hadley","Wickham"),
  year = "2020",
  publisher = " O'Reilly Media, Inc.",
  url = "https://https://mastering-shiny.org//"
)
# Get the R reference
rref <- citation()
# Create ref key
rref$key <- "rversion"
# Write the R reference
pkgs <- bibtex::read.bib("vignettes/packages.bib")
bibtex::write.bib(
  purrr::reduce(list(rref, hadley, pkgs), append), 
  file = fs::path("vignettes", "packages.bib")
)

shinymods

R-CMD-check Codecov test coverage Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. license Last-changedate

The goal of shinymods is to package some convenient Shiny [@shiny] modules that are often used to build an app. Some of the modules are inspired by the book Mastering Shiny [@Wickham2020].

You can also vendor the source R code to your own project to prevent having excessive dependencies.

Credits

This R [@rversion] package is intended to help you construct Shiny [@shiny] applications. Some of the modules are derived from examples in the book Mastering Shiny: Build Interactive Apps, Reports, and Dashboards Powered by R by @Wickham2020.

Installation

You can install the development version of shinymods from GitHub with:

# install.packages("devtools")
devtools::install_github("MartinSchobben/shinymods")

Example

This is a basic example of a shiny app that requires filtering based on the variables in a dataframe, where the controllers are conditional to the value ranges of that particular variable.

library(shiny)
library(shinymods)
## basic example code

ui <- fluidPage(
        sidebarLayout(
          sidebarPanel(
            dataset_ui("test", filter = is.data.frame),
            filter_ui("test")
          ),
          mainPanel(
            tableOutput("table")
          )
        )
      )


server <- function(input, output, session) {
  dt <- dataset_server("test")
  ft <- filter_server(dt, "test", shinyjs = FALSE)
  output$table <- renderTable({req(ft()); ft()})
}

shinyApp(ui, server)

References



MartinSchobben/shinymods documentation built on June 7, 2022, 4:38 p.m.