[問題] shiny疑問
大家好 最近用shiny寫個小程式
上網找樣本然後自己來練習
想請問一下 shiny 是否有個類似開關的物件??
敘述如下
http://i.imgur.com/GmCCY5p.jpg
![](https://i.imgur.com/GmCCY5p.jpg)
目前自己做的開關是用0/1來表示
現在想做的構想是,如果橫條選到0
則以下的清單都不可以動作
(畫面暗掉,不能動作,類似這樣的layout)
以下是我的程式碼
ui.r部分
library(shiny)
# Define UI for slider demo application
fluidPage(
# Application title
titlePanel("簡訊通知"),
# Sidebar with sliders that demonstrate various available
# options
sidebarLayout(
sidebarPanel(
# Simple integer interval
sliderInput("開關", "開關:",
min=0, max=1, value=1,step=1),
# Decimal interval with step value
sliderInput("發送時間", "發送時間:",
min = 8, max = 19, value = 1, step= 1,post=":00"),
# Specification of range within an interval
sliderInput("逾時", "逾時:",
min = 0, max = 23 , value = 1,step=1),
# Provide a custom currency format for value display,
# with basic animation
# Animation with custom interval (in ms) to control speed,
# plus looping
sliderInput("發訊時間", "發訊時間:",8, 19, 8,
step = 1, animate=
animationOptions(interval=1000, loop=TRUE))
),
# Show a table summarizing the values entered
mainPanel(
tableOutput("values")
)
)
)
sever.r部分
library(shiny)
# Define server logic for slider examples
function(input, output) {
# Reactive expression to compose a data frame containing all of
# the values
sliderValues <- reactive({
# Compose data frame
data.frame(
setting = c("開關",
"發送時間",
"逾時",
"發訊時間"),
Value = as.character(c(input$開關,
input$發送時間,
paste(input$逾時, collapse=' '),
input$發訊時間)),
stringsAsFactors=FALSE)
})
# Show the values using an HTML table
output$values <- renderTable({
sliderValues()
})
}
以上 感謝各位大大
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.240.249.32
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1480427024.A.769.html
推
11/29 22:14, , 1F
11/29 22:14, 1F
推
11/29 22:19, , 2F
11/29 22:19, 2F
→
11/29 22:25, , 3F
11/29 22:25, 3F
→
11/29 22:25, , 4F
11/29 22:25, 4F
→
11/29 22:26, , 5F
11/29 22:26, 5F
討論串 (同標題文章)