关于 r:get selected row in a datatable in an interactive document using Rmarkdown and shiny | 珊瑚贝

get selected row in a datatable in an interactive document using Rmarkdown and shiny


我正在使用 Rmarkdown 和 Shiny 探索在交互式文档中使用 DT:datatable(我以前没有使用过 datatable)。

我能够创建一个绘制数据表的文档:

1
2
3
4
5
6
7
8
9

title:”Test DT”
output: html_document
runtime: shiny

“`{r echo=FALSE}
datatable(iris)
“`

在数据表中单击一行会突出显示一行。有没有办法在不实现闪亮服务器的情况下访问选定的行?怎么样?


您必须使用 output$id 才能使其工作。你将如何在闪亮的自身中做到这一点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

title:”Test DT”
output: html_document
runtime: shiny

“`{r echo=FALSE}

library(DT)

DT::dataTableOutput(‘irisTable’)
output$irisTable = DT::renderDataTable(iris, selection = ‘multiple’)

p(“By default DT allows multiple row selection. Selected rows are…”)
renderPrint(input$irisTable_rows_selected)

“`

DT 还允许选择列和单元格以及预选。请参阅文档


来源:https://www.codenong.com/34358923/

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?