我目前正在嘗試製作一個R閃亮的應用程序,用戶可以在每行中的多個列上進行搜索。此功能可以使用閃亮環境以外的DT
軟件包中的datatable
功能。以iris
數據集爲例,我想搜索包含值的所有行; 5.1,3.5和1.4。如果我在交互式數據表窗口「5.1 3.5 1.4」的搜索框中鍵入以下字符串,則顯示行1和18。在Shiny中搜索多列Datatable
library(DT)
head(iris)
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1 5.1 3.5 1.4 0.2 setosa
# 2 4.9 3.0 1.4 0.2 setosa
# 3 4.7 3.2 1.3 0.2 setosa
# 4 4.6 3.1 1.5 0.2 setosa
datatable(iris)
問題是,當我嘗試做一個閃亮的環境中同樣的事情,我收到消息
沒有找到匹配的記錄。
例如:
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(fluidRow(column(12, DT::dataTableOutput('tbl')))),
server = function(input, output) {
output$tbl = DT::renderDataTable(
iris, options = list(lengthChange = FALSE)
)
}
)
}
沒有人有周圍的工作,或者可以告訴我,我做錯了嗎?
如果設置'服務器= FALSE'內'renderDataTable',它的工作原理。顯然,由於某些原因,Shiny存在空間問題;可能是一個錯誤。 – alistaire
嘿alistaire,是的,我剛剛發現。謝謝。 –
@alistaire'server = TRUE'很棘手。我發佈了一個答案。 –