「Shiny によるデータシステム演習」では,Web 情報システムに関する次のことを演習形式で学ぶ.
URL: https://shiny.rstudio.com/gallery/
Webブラウザでボタン,スライダ,メニュー 等を操作すると,直ちに結果が得られる
Shiny の機能
Shiny の機能
R システムの標準オブジェクト
米国イエローストン公園内の間欠泉「オールド・フェイスフル・ガイザー」 その噴出持続時間 (erupition)と、噴出間隔 (waiting)
shiny のインストール
install.packages("shiny")
shiny を動かしてみる
ファイル名はこの通りにすること. 2つのファイルは、同じディレクトリ(フォルダ) に置くこと
ui.R
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("breaks",
"please select a number:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
))
server.R
library(shiny)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
hist(faithful[,2], breaks = input$breaks)
})
})
library(shiny)
runApp("C:/Users/user")
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("breaks",
"please select a number:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
textOutput("distPrint")
)
)
))
library(shiny)
shinyServer(function(input, output) {
output$distPrint <- renderText({
input$breaks * 12
})
})
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel (
numericInput("breaks",
"value = ?", value=0)
),
mainPanel(
textOutput("distPrint")
)
)
))