library(shiny)
library(DT)
##
## Attaching package: 'DT'
## The following objects are masked from 'package:shiny':
##
## dataTableOutput, renderDataTable
datatable(faithful)
x <- faithful[, 2]
if ( file.exists('') )
{
settings <- read.csv(file = 'ディズニー', stringsAsFactors = F)
} else
{
settings <- NULL
settings$階級数 <- 30
}
ui <- fluidPage(
titlePanel("ディズニーシーの人気アトラクション6/30待ち時間"),
tableOutput("設定表示"),
sliderInput("階級数",
"階級数を入力して下さい:",
min = 1,
max = 100,
value = settings$階級数),
plotOutput("ヒストグラム", width = 400, height = 200),
textOutput("メッセージ"),
textOutput("設定保存")
)
server <- function(input, output)
{
output$設定表示 <- renderTable(settings,
width = 300,
caption = 'ユーザー設定値(初期値)')
output$ヒストグラム <- renderPlot({
hist(x, breaks = input$階級数,
ylab = "度数",
xlab = "分")
})
output$メッセージ <- renderText({
paste(input$地域, 'が選択されました。次回の初期値として保存されます。')
paste('PWD:', getwd())
})
output$設定保存 <- renderText({
settings$地域 <- input$地域
write.csv(settings, file = 'USRFILE', quote = F, row.names = F)
return(NULL)
})
}
shinyApp(ui = ui, server = server)
## PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
Shiny applications not supported in static R Markdown documents