Skip to content

Instantly share code, notes, and snippets.

@ChrisBeeley
ChrisBeeley / app.R
Last active June 12, 2017 17:28
Single file app which takes various GET parameters and returns the appropriate date boxes (see below for link to blog post)
library(shiny)
library(lubridate)
server = function(input, output, session){
# type = date rolling n months, quarters
output$dateControls <- renderUI({
@ChrisBeeley
ChrisBeeley / server.R
Last active August 29, 2015 14:26
Minimal application for Shiny Book, 2nd edition
library(shiny) # load Shiny at the top of both scripts
shinyServer(function(input, output) { # define application in here
output$textDisplay <- renderText({ # mark function as reactive
# and assign to output$textDisplay for passing to ui.R
paste0("You said '", input$comment, # from the text
"'. There are ", nchar(input$comment), # input control as
" characters in this.") # defined in ui.R
@ChrisBeeley
ChrisBeeley / server.R
Last active October 2, 2019 15:55
Demo to show widget types, return values and data types in Shiny
function(input, output) {
output$textDisplay <- renderTable({
getMat = matrix(
c(paste(input$checkGroup, collapse=','), class(input$checkGroup),
input$boxInput, class(input$boxInput),
as.character(as.Date(input$theDate, origin = "1970-01-01")), class(input$theDate),
paste(as.character(as.Date(input$dateRange[[1]], origin = "1970-01-01")),
as.character(as.Date(input$dateRange[[2]], origin = "1970-01-01")),
####################################
##### minimal example - server.R ###
####################################
library(shiny) # load shiny at beginning at both scripts
shinyServer(function(input, output) { # server is defined within these parentheses
output$textDisplay <- renderText({ # mark function as reactive and assign to
# output$textDisplay for passing to ui.R