flowchart LR A(匯入) --> B(複製) B --> C(貼上) C --> D{篩選} D --> E[樞紐分析] D --> F[合併彙算] E --> G[繪圖] F --> G[繪圖] G --> H(匯出)
shiny能幫助企業(或自己)做什麼?
shiny簡介
第一個shiny範例(“01_hello”)
結論
建立企業級商業智慧,營運智慧與儀表板應用
營運資料互動式分析與視覺化應用(產銷人發財)
辦公室自動化分析應用
flowchart LR A(匯入) --> B(複製) B --> C(貼上) C --> D{篩選} D --> E[樞紐分析] D --> F[合併彙算] E --> G[繪圖] F --> G[繪圖] G --> H(匯出)
http://rwepa.blogspot.com/2021/10/r-shiny-quality-control-chart.html
http://rwepa.blogspot.com/2021/10/r-shiny-quality-control-chart.html
Makes it incredibly easy to build interactive web applications with R.
Automatic “reactive” binding between inputs and outputs and extensive prebuilt widgets.
Make it possible to build beautiful, responsive, and powerful applications with minimal effort.
方法1: app.R (簡易架構,適用於小型方案)
方法2: ui.R + server.R (完整架構,適用於企業應用)
# 載入套件
library(shiny)
# 第1部分 Define UI for app that draws a histogram ----
ui <- fluidPage(
# 1.1 App title ----
titlePanel("Hello Shiny!"),
# 1.2 Sidebar layout with input and output definitions ----
sidebarLayout(
# 1.2.1 Sidebar panel for inputs ----
sidebarPanel(
# Input: Slider for the number of bins ----
sliderInput(inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30)
),
# 1.2.2 Main panel for displaying outputs ----
mainPanel(
# Output: Histogram ----
plotOutput(outputId = "distPlot")
)
)
)
# 第2部分 Define server logic required to draw a histogram ----
server <- function(input, output) {
# Histogram of the Old Faithful Geyser Data ----
# with requested number of bins
# This expression that generates a histogram is wrapped in a call
# to renderPlot to indicate that:
#
# 1. It is "reactive" and therefore should be automatically
# re-executed when inputs (input$bins) change
# 2. Its output type is a plot
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")
})
}
shiny能幫助企業(或自己)做什麼 --> 互動式預測模型(Interactive Predictive Model)
理解 shiny 套件的運作方法
“01_hello”
四大區塊: library, ui, server, runApp