Skip to content

Instantly share code, notes, and snippets.

@zikrach
zikrach / server.r
Created January 11, 2018 16:52 — forked from wch/server.r
renderImage example for Shiny
shinyServer(function(input, output, clientData) {
output$myImage <- renderImage({
# A temp file to save the output.
# This file will be removed later by renderImage
outfile <- tempfile(fileext='.png')
# Generate the PNG
png(outfile, width=400, height=300)
hist(rnorm(input$obs), main="Generated in renderImage()")
dev.off()