R:DT 包(版本 0.1.56 -> 开发版)列过滤器不起作用
R: DT package (Version 0.1.56 -> development version) column filters are not working
我对 DT 包(版本 0.1.56 -> 开发版)有问题。
DT 过滤器不工作,
这是可重现的例子:
library(shiny)
library(DT)
library(ggplot2)
data <- structure(list(x = c(71063, 71063, 71063, 71063, 71063,
71063), y = c(200183, 200183, 200183, 200183, 200183, 200183
), z = c("G1", "G1", "G1", "G1", "G1", "G1")), .Names = c("x",
"y", "z"), class = "data.frame", row.names = c(NA, 6L
))
data$z <- as.factor(as.character(data$z))
data$x <- as.numeric(as.character(data$x))
shinyApp(
ui = fluidPage(dataTableOutput('tableId')),
server = function(input, output) {
output$tableId = renderDataTable({
datatable(data, filter="top",options = list(pageLength = 100, lengthMenu=c(100,200,300,400,500,600)))
})
}
)
一开始我认为这是列类型(未知或字符)的问题,但事实并非如此!
我试过:
data$z <- as.factor(as.character(data$z)) ...
列类型已更改,但过滤器仍然不可用。
*有了 DT 的 CRAN 版本,一切都运行顺利...有什么想法吗?
干杯
我现在知道为什么这些过滤器不起作用了。这不是错误。这些列没有超过一个唯一值 -> 所以没有什么可以过滤...
我对 DT 包(版本 0.1.56 -> 开发版)有问题。
DT 过滤器不工作,
这是可重现的例子:
library(shiny)
library(DT)
library(ggplot2)
data <- structure(list(x = c(71063, 71063, 71063, 71063, 71063,
71063), y = c(200183, 200183, 200183, 200183, 200183, 200183
), z = c("G1", "G1", "G1", "G1", "G1", "G1")), .Names = c("x",
"y", "z"), class = "data.frame", row.names = c(NA, 6L
))
data$z <- as.factor(as.character(data$z))
data$x <- as.numeric(as.character(data$x))
shinyApp(
ui = fluidPage(dataTableOutput('tableId')),
server = function(input, output) {
output$tableId = renderDataTable({
datatable(data, filter="top",options = list(pageLength = 100, lengthMenu=c(100,200,300,400,500,600)))
})
}
)
一开始我认为这是列类型(未知或字符)的问题,但事实并非如此!
我试过:
data$z <- as.factor(as.character(data$z)) ...
列类型已更改,但过滤器仍然不可用。
*有了 DT 的 CRAN 版本,一切都运行顺利...有什么想法吗?
干杯
我现在知道为什么这些过滤器不起作用了。这不是错误。这些列没有超过一个唯一值 -> 所以没有什么可以过滤...