inst/apps/plotting_special/server.R

server = function(input, output, session) {

  output$barplot <- renderPlot({
      par(oma = c(0,0,0,0), mar = c(4.5,4,2,2))
      input$bareval
      return(isolate(eval(parse(text=input$barcode))))
})
  output$piechart <- renderPlot({
      par(oma = c(0,0,0,0), mar = c(4.5,4,2,2))
      input$pie
      return(isolate(eval(parse(text=input$piecode))))
})
  output$boxplot <- renderPlot({
      par(oma = c(0,0,0,0), mar = c(4.5,4,2,2))
      input$boxeval
      return(isolate(eval(parse(text=input$boxcode))))
})
output$trellis <- renderPlot({
    plot(datasets::mtcars[,c(input$mtcars)], col = rainbow(length(input$mtcars)), 
         pch = 16, cex = 1+length(input$mtcars)*.1)
})
}

Try the teachingApps package in your browser

Any scripts or data that you put into this service are public.

teachingApps documentation built on July 1, 2020, 5:58 p.m.