Shiny flexmarkdown中的选择性数据表创建
我正在尝试为我的Shiny flexmarkdown中的选择性数据表创建,shiny,interactive,dt,flexdashboard,Shiny,Interactive,Dt,Flexdashboard,我正在尝试为我的flexmarkdown工作表中的datatable对象构建选择器 这是我当前的(示例)布局,我正在尝试构建一个反应式选择器,它在左侧接受矿物类型输入,然后重新渲染 在这种情况下,整个表格仅用于选择“岩石类型=类型1” 完整来源@pastebin,请点击此处: 我当前的选择器: ```{r} selectInput("input_type","Mineral Type:", data$`Rock Type`) ``` 我可以通过下面的操作来实现这一点,但我也希望为所有/无分组
flexmarkdown
工作表中的datatable
对象构建选择器
这是我当前的(示例)布局,我正在尝试构建一个反应式选择器,它在左侧接受矿物类型输入,然后重新渲染
在这种情况下,整个表格仅用于选择“岩石类型=类型1”
完整来源@pastebin,请点击此处:
我当前的选择器:
```{r}
selectInput("input_type","Mineral Type:", data$`Rock Type`)
```
我可以通过下面的操作来实现这一点,但我也希望为所有/无分组建立一个选择
```{r}
dataInput <- reactive({
subset(data,data$`Rock Type` == input$input_type)
})
renderDataTable(dataInput())
```
`{r}
dataInput您可以在selectInput中添加一个All选项,您可以在以下列表中选择该选项:
```{r}
selectInput("input_type","Mineral Type:", c("All", unique(data$`Rock Type`))
```
```{r}
dataInput <- reactive({
if(input$input_type=="All")
data
else
subset(data,`Rock Type` == input$input_type)
})
renderDataTable(dataInput())
```
`{r}
选择输入(“输入类型”,“矿物类型:”,c(“全部”),唯一(数据$`Rock type`)
```
```{r}
数据输入