Browse Source

shinydashboard 学习

liuyuqi-dellpc 8 years ago
parent
commit
756ba006af
3 changed files with 20 additions and 5 deletions
  1. 11 0
      server.R
  2. 9 5
      ui.R
  3. BIN
      www/bigorb.png

+ 11 - 0
server.R

@@ -19,5 +19,16 @@ shinyServer(function(input, output) {
     hist(x, breaks = bins, col = 'darkgray', border = 'white')
     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)
+  })
 
 
 })
 })

+ 9 - 5
ui.R

@@ -4,13 +4,12 @@
 #
 #
 # http://shiny.rstudio.com
 # http://shiny.rstudio.com
 #
 #
-
 library(shiny)
 library(shiny)
-
-shinyUI(fluidPage(
+library(shinydashboard)
+shinyUI(fluidPage(theme=shinytheme("cerulean"),
 
 
   # Application title
   # Application title
-  titlePanel("Old Faithful Geyser Data"),
+  titlePanel("shiny-demo数据分析"),
 
 
   # Sidebar with a slider input for number of bins
   # Sidebar with a slider input for number of bins
   sidebarLayout(
   sidebarLayout(
@@ -24,7 +23,12 @@ shinyUI(fluidPage(
 
 
     # Show a plot of the generated distribution
     # Show a plot of the generated distribution
     mainPanel(
     mainPanel(
+      strong(h3("这是我的第一个app应用",style="color:violetred")),
+      h4("如果想学习更多的shiny知识请访问我的博客:",
+         span(a("请点击此处",href="http://blog.yoqi.me"))),
+      br(),
+      p("我们将利用鸢尾花数据集进行案例演示"),
       plotOutput("distPlot")
       plotOutput("distPlot")
     )
     )
   )
   )
-))
+))

BIN
www/bigorb.png