12345678910111213141516171819202122232425262728293031323334 |
- # This is the server logic for a Shiny web application.
- # You can find out more about building applications with Shiny here:
- #
- # http://shiny.rstudio.com
- #
- library(shiny)
- shinyServer(function(input, output) {
- output$distPlot <- renderPlot({
- # generate bins based on input$bins from ui.R
- x <- faithful[, 2]
- bins <- seq(min(x), max(x), length.out = input$bins + 1)
- # draw the histogram with the specified number of bins
- hist(x, breaks = bins, col = 'darkgray', border = 'white')
- })
-
- # 向用户界面输出iris数据表,根据input$n输出行数
- output$mytable <- renderTable({
- head(iris,input$n)
- })
-
- # 用用户界面输出箱线图,并根据input$outliers是否输出异常点
- output$myplot <- renderPlot({
- boxplot(Sepal.Length~Species,data=iris,
- col=rainbow(3),outline = input$outliers)
- })
- })
|