Giter Club home page Giter Club logo

shinycustom's Introduction

shinyCustom

Introduction

This package is under development. It automates, to some extent, the creation of custom objects for the RStudio's Shiny framework.

To see an example, try:

install.packages("htmltools")
devtools::install_github("homerhanumat/shinyCustom")
shiny::runApp(system.file("examples/shinyapp", package = "shinyCustom"),
              display.mode = "showcase")

At the present time the package supports three custom inputs, all of which are intended to keep the Shiny server from having to perform expensive computations that the user probably did not need. Typically this is accomplished by means of a "Submit"" action button, but in some apps the users may wish to perform so many computations that constant use of a Submit button becomes tiresome. The inputs provided in this package solve the problem by restricting the conditions under which the input sends update-messages to the server, and/or by a rate policy that the author of the app can set.

The supported inputs are:

  • customTextInput()
  • customNumericInput()
  • customSliderInput()

The first two inputs are "patient", in the sense that they update if and only if the user presses the Enter key or shifts focus away from the input control.

All three inputs permit the rate policy to be customized. (For an explanation of rate policies, see this RStudio article.

Usage

In a Standard Shiny App

The procedure for invoking the features of the package is inspired by Dean Attali's shinyjs. Simply insert a call to useShinyCustom() within the UI, preferably near the top. Here's an example:

library(shiny)
library(shinyCustom)

ui <- fluidPage(
  useShinyCustom(slider_delay = "1500"),
  customSliderInput(inputId = "slow", label = "I'm a Lazy Slider!",
                    min = 0, max = 100, value = 0),
  verbatimTextOutput("slowout")
)

server <- function(input, output) {
  output$slowout <- renderText({
    input$slow
  })
}

shinyApp(ui, server)

In an Interactive R Markdown Document

Simply place the call to useShinyCustom() at the beginning of the code chunk that contains your first interactive element. Make sure to set the rmd argument to TRUE.

useShinyCustom(rmd = TRUE)
inputPanel(
  customNumericInput("number", label = "Patient Numeric Input",
                     min = 0, max = 100, step = 1, value = 50)
)
renderText({
  as.character(input$number)
})

Limitations

Currently the package cannot be with used apps in which the entire user interface is built in an index.html file.

This package has not undergone much testing. If you happen upon it feel free to give it a try, but do please post an issue when you find something going wrong.

shinycustom's People

Contributors

homerhanumat avatar

Stargazers

Jimmy Briggs avatar Jacob Townson avatar David Granjon avatar Max Todaro avatar Christophe Dervieux avatar Rob Gilmore avatar Marcus W Beck avatar  avatar

Watchers

 avatar Jacob Townson avatar  avatar  avatar

shinycustom's Issues

patient inputs for sliders?

Is it feasible to have customSliderInput receive patient inputs like customNumericInput? The slider delay is helpful but I would prefer the slider to update when focus is shifted.

update inputs

Hi there, I've noticed that the regular shiny functions for reactively updating widgets (e.g., updateSliderInput) don't work with the shinyCustom functions. Is it simple to create something like updatecustomSliderInput? Thanks!

slowNumericInput up/down arrow

Do you know why the outlook of slowNumericInput is different with that of numericInput?
The numericInput widget includes two arrows on the right side and the user can use up/down arrows to increase/decrease the number.
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.