小编Hil*_*ary的帖子

R Shiny selectInput依赖于另一个selectInput

我在下面有一些数据,我用它来制作R闪亮的圆环图,其中date是一个角色.我希望能够选择我想要查看其分数的电子邮件,但是在第二个下拉选项中只能看到该电子邮件具有活动的日期.

例如,如果我在第一个下拉列表中选择email = xxxx,我希望在日期选择字段中只看到"无活动".而对于email = yyyy,我希望只看到6/17/14,6/18/14,16/19/14作为选择.

我在ui中尝试过一种嵌套的子集.例:

> ui <- shinyUI(fluidPage(
+   sidebarLayout(
+     sidebarPanel(
+       selectInput('Select', 'Customer:', choices = unique(as.character(dat5$email))),
+       selectInput("User", "Date:", choices = dat5[dat5$email==input$Select,date])
+     ),
+     mainPanel(plotOutput("distPlot"))
+   )
+ ))
Run Code Online (Sandbox Code Playgroud)

但这仍然显示所有可能的日期选择

数据

email   date        variable    value   ymin    ymax
xxxx    no activity e_score         0   0       0
xxxx    no activity diff            1   0       1
yyyy    6/17/14     e_score    0.7472   0       0.7472
yyyy    6/17/14     diff       0.2528   0.7472  1
yyyy    6/18/14     e_score    0.373    0       0.373
yyyy    6/18/14     diff …
Run Code Online (Sandbox Code Playgroud)

r shiny shinydashboard

21
推荐指数
2
解决办法
1万
查看次数

R选择在特定日期之前发生的数据

所以我有两个看起来像这样的数据集(表):

数据集A:

Email   Date    Action
aaaa    1/5/14  won
bbbb    2/10/14 won
cccc    1/14/14 won
dddd    3/3/14  won
eeee    4/19/14 won
Run Code Online (Sandbox Code Playgroud)

数据集B:

Email   Date    Action
aaaa    1/5/14  won
aaaa    1/6/14  call
aaaa    1/9/14  email
aaaa    1/20/14 email
bbbb    2/8/14  email
bbbb    2/9/14  email
bbbb    2/10/14 won
bbbb    2/11/14 callback
bbbb    2/12/14 email
bbbb    2/13/14 won
cccc    1/14/14 won
cccc    1/16/14 call
dddd    2/3/14  email
dddd    3/3/14  won
eeee    4/19/14 won
eeee    4/21/14 call
Run Code Online (Sandbox Code Playgroud)

我希望它看起来像这样:

Email   Date    Action
bbbb    2/8/14  email
bbbb …
Run Code Online (Sandbox Code Playgroud)

r

1
推荐指数
1
解决办法
472
查看次数

标签 统计

r ×2

shiny ×1

shinydashboard ×1