Skip to content

Instantly share code, notes, and snippets.

@aagarw30
aagarw30 / server.r
Last active January 5, 2022 17:55
R Shiny Download GGPLOT demo
library(shiny)
library(ggplot2)
shinyServer(function(input,output)({
# x contains all the observations of the x variable selected by the user. X is a reactive function
x <- reactive({
iris[,as.numeric(input$var1)]
})
# x contains all the observations of the y variable selected by the user. Y is a reactive function
y <- reactive({
iris[,as.numeric(input$var2)]