Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:基于datatable中选定行的条件面板_R_Shiny - Fatal编程技术网

R:基于datatable中选定行的条件面板

R:基于datatable中选定行的条件面板,r,shiny,R,Shiny,我是新手。我想根据我在datatable中选择的行获得一个新面板。到目前为止,我已经添加了以下代码,但它似乎不起作用。您必须设置什么条件才能显示新面板并移除以前的面板 library(shiny) ui <- fluidPage( conditionalPanel( condition <- "is. null(input.dt_rows_selected) == TRUE", DT::dataTableOutput(outputId = "dt") ), condition

我是新手。我想根据我在datatable中选择的行获得一个新面板。到目前为止,我已经添加了以下代码,但它似乎不起作用。您必须设置什么条件才能显示新面板并移除以前的面板

library(shiny)

ui <- fluidPage(

conditionalPanel(
condition <- "is. null(input.dt_rows_selected) == TRUE",
DT::dataTableOutput(outputId = "dt")
),
  conditionalPanel(
condition <- "is. null(input.dt_rows_selected) == FALSE" ,
h3("Plots based on the selected row ")
)
)


server <- function(input, output){

output$dt <- DT::renderDataTable(
mtcars, server = FALSE, selection = 'single'
)
}


shinyApp(ui =ui, server = server)
库(闪亮)

ui您需要选中两个选项:

1) 输入存在

2) 输入>0

比如:

conditionalPanel(
    condition ="typeof input.dt_rows_selected  === 'undefined' || input.dt_rows_selected.length <= 0",
    DT::dataTableOutput(outputId = "dt"))
  ,
  conditionalPanel(
    condition = "typeof input.dt_rows_selected  !== 'undefined' && input.dt_rows_selected.length > 0" ,
    h3("Plots based on the selected row ")
  )
条件面板(
condition=“typeof input.dt_rows_selected==”未定义“| | input.dt_rows_selected.0”,
h3(“基于选定行的绘图”)
)

选择行DT隐藏和文本显示后

非常感谢。这正是我想要的:)