library(shiny) ui <- fluidPage( titlePanel("Joonis"), textInput("tekst1", label="Joonise pealkiri", value="Diameetrite jaotus"), textInput("tekst2", label="Y-telje pealkiri", value="kogus"), sliderInput("slaider1", label="usaldusnivoo", max = 99, min=90, value=95), selectInput("valik1", label="Vali õunasort", choices=c("Liivi sibul", "Kuldrenett")), plotOutput("joonis1") ) server <- function(input, output) { ounad=read.table("http://www.tlu.ee/~jaagup/andmed/muu/ounad/ounad1000.txt", sep=",", header=TRUE) output$joonis1 <- renderPlot({ andmed=ounad[ounad$ounasort==input$valik1, "diameeter"] plot(density(andmed), main=input$tekst1, ylab=input$tekst2) abline(v=mean(andmed), col="red", lty=2) tulemus=t.test(andmed, conf.level=input$slaider1/100) abline(v=tulemus$conf.int, col="blue") }) } shinyApp(ui = ui, server = server)