I am new to Shiny, so excuse if this is trivial...
I have a server() function that outputs several plots. The plots use the same block of code and each adds some of its own, like this:
shinyServer( function( input, output ){
output$plot1 <- renderPlot({
the block of the same code
some code specific to plot1
})
output$plot1 <- renderPlot({
The block of the same code
some code specific to plot2
})
I want to avoid repeating "the block of the same code". This has to be in the renderPlot function since it takes changeable data from the UI function.