Skip to content

Instantly share code, notes, and snippets.

View jcheng5's full-sized avatar

Joe Cheng jcheng5

View GitHub Profile
@jcheng5
jcheng5 / css.R
Last active August 29, 2015 13:56
CSS DSL for R
library(shiny)
css <- local({
cssRules <- function(rules) {
paste(
' ',
gsub('.', '-', names(rules), fixed = TRUE),
': ',
rules,
';',
@jcheng5
jcheng5 / DESCRIPTION
Created March 1, 2014 06:55
Select vs. Selectize
Type: Shiny
DisplayMode: Showcase
Title: Selectize vs. Select comparison
shinyServer(function(input, output, session) {
updateSelectInput(session, 'foo', choices=1:11)
})
@jcheng5
jcheng5 / global.R
Created March 10, 2014 23:03
SuperZip example License: MIT
library(dplyr)
allzips <- readRDS("data/superzip.rds")
allzips$latitude <- jitter(allzips$latitude)
allzips$longitude <- jitter(allzips$longitude)
allzips$college <- allzips$college * 100
allzips$zipcode <- formatC(allzips$zipcode, width=5, format="d", flag="0")
row.names(allzips) <- allzips$zipcode
cleantable <- allzips %.%
@jcheng5
jcheng5 / DESCRIPTION
Last active August 29, 2015 13:57 — forked from trestletech/server.R
Title: Telephones by region
Author: Jeff Allen <jeff@rstudio.com>
AuthorUrl: http://www.rstudio.com/
License: MIT
DisplayMode: Showcase
Tags: sidebarlayout helptext selectinput
Type: Shiny
# Define a dataset globally which will be available
# both to the UI and to the server.
# Rely on the 'WorldPhones' dataset in the datasets
# package (which generally comes preloaded).
library(datasets)
# Trim out the non-consecutive year from
@jcheng5
jcheng5 / DESCRIPTION
Last active August 29, 2015 13:57 — forked from trestletech/server.R
Title: Dynamic Clustering
Author: Jeff Allen <jeff@rstudio.com>
AuthorUrl: http://www.rstudio.com/
License: MIT
DisplayMode: Showcase
Tags: mclust clustering clickid observe isolate
Type: Shiny
@jcheng5
jcheng5 / DESCRIPTION
Last active August 29, 2015 13:57 — forked from trestletech/server.R
Title: Basic DataTable
Author: Jeff Allen <jeff@rstudio.com>
AuthorUrl: http://www.rstudio.com/
License: MIT
DisplayMode: Showcase
Tags: mtcars selectinput datatables
Type: Shiny
@jcheng5
jcheng5 / server.R
Created March 13, 2014 01:09
Progress example License: MIT
library(shinyIncubator)
shinyServer(function(input, output, session) {
output$plot <- renderPlot({
if (input$go == 0)
return()
# Wrap the entire expensive operation with withProgress
withProgress(session, {
setProgress(message = "Calculating, please wait",
@jcheng5
jcheng5 / server.R
Created March 14, 2014 17:46
Navbar example License: MIT
shinyServer(function(input, output, session) {
output$plot <- renderPlot({
plot(cars, type=input$plotType)
})
output$summary <- renderPrint({
summary(cars)
})
output$table <- renderDataTable({