简体   繁体   English

DT Shiny R - [输入$ tableId_rows_all,]不起作用

[英]DT Shiny R - [input$tableId_rows_all, ] not working

i am not able to display all filtered rows from datatable in a plot, and the function, which suppose to use all filtered rows -> input$tabelle_rows_all , uses the rows only on the current page! 我无法在绘图中显示数据表中的所有已过滤行,并且该函数(假设使用所有已过滤的行 - > input$tabelle_rows_all仅使用当前页面上的行! My DT version is 0.1, and i cannot update it to github version . 我的DT版本是0.1,我无法将其更新为github版本 I have tried many approaches, first via devtools::install_github('rstudio/DT') but i got an error 我尝试了很多方法,首先通过devtools::install_github('rstudio/DT')但我收到了一个错误

...--install-tests Der Befehl "C:\Program" ist entweder falsch geschrieben oder konnte nicht gefunden werden. Error: Command failed (1)

than i downloaded the development version ( https://github.com/rstudio/DT/archive/master.tar.gz ) and i used command 比我下载的开发版本( https://github.com/rstudio/DT/archive/master.tar.gz )和我用的命令

install.packages("C:/Users/XX/Downloads/DT-master.tar.gz",lib="C:/Users/XX/Docu‌​ments/R/win-library/3.2") . install.packages("C:/Users/XX/Downloads/DT-master.tar.gz",lib="C:/Users/XX/Docu‌​ments/R/win-library/3.2")

However still i got error: 但是我仍然有错误:

Warning in install.packages : package 'C:/Users/XX/Downloads/DT-master.tar.gz' is not available (for R version 3.2.3) ... Warning in install.packages : package 'C:/Users/XX/Downloads/DT-master.tar.gz' is not available (for R version 3.2.3) ...

This is very necessary and important option which i need for DT, is there anyway i could get it done? 这是我需要DT的非常必要和重要的选项,无论如何我能完成它吗?

Easy example of the code: 简单的代码示例:

library(shiny)
library(DT)
library(ggplot2)

x <- as.numeric(1:1000000)
y <- as.numeric(1:1000000)
data <- data.frame(x,y)

shinyApp(
  ui = fluidPage(dataTableOutput('tableId'),
                 plotOutput('plot1')),
  server = function(input, output) {    
    output$tableId = renderDataTable({
      datatable(data, options = list(pageLength = 100, lengthMenu=c(100,200,300,400,500,600)))
    })
    output$plot1 = renderPlot({
      filtered_data <- data[input$tableId_rows_all, ]
      ggplot(data=filtered_data, aes(x=x,y=y)) + geom_line()
    })
  }
)

Thanks for any interest 感谢您的任何兴趣

[Just to clear it one more time] : [再次清除它]

I got quite big data (>5000000 rows), and i display it in shiny app using datatable ( DT ) with filters. 我得到了相当大的数据(> 5000000行),我使用数据表( DT )和过滤器在闪亮的应用程序中显示它。 Depending on the user preferences for filtering, lets assume it gives us 550 rows (but it can give us more or less than that). 根据用户对过滤的偏好,我们假设它给了我们550行(但它可以给我们更多或更少)。 Because of pagination I am not able to see all 550 rows (assuming pageLength is 100) or whats even worse, i am not able to display all filtered rows further in a plot , as function input$tabelle_rows_all uses the rows on the current page (i must first change the entries number). 由于分页,我无法看到所有550行(假设pageLength为100)或者甚至更糟, 我无法在绘图中进一步显示所有已过滤的行 ,因为函数input$tabelle_rows_all 使用当前页面上的行 (我必须先更改条目号码)。 Is there any way to get all found rows after filtering datatable (not depended on pageLength )? 有没有办法在过滤数据表之后获取所有找到的行(不依赖于 pageLength )?

I read somewhere that the problem might be with the version od DT , so maybe DT 0.1 does not support the function to plot all the found rows, so i am hoping that the github version of DT is the solution of my problem. 我在某地读到问题可能是版本od DT ,所以DT 0.1不支持绘制所有找到的行的函数,所以我希望DT的github版本是我的问题的解决方案。 But i might be wrong! 但我可能错了!

Based on the error you're getting I believe you have newer version of R (3.2.3) which is not yet supported by the DT package. 根据你得到的错误,我相信你有更新版本的R(3.2.3)DT包尚不支持。

If you downgrade your R version to an older one it should work (it works fine for me on Version 3.1.2). 如果你将你的R版本降级到较旧版本它应该可以工作(它在版本3.1.2上适用于我)。 This article might help you installing an old version of R if you are using Rstudio, or this topic if you are using R on ubuntu. 如果您正在使用Rstudio, 本文可能会帮助您安装旧版本的R,如果您在ubuntu上使用R,则可以使用此主题

Once you install the old(er) version of R, you can install the package by typing: 安装旧的(呃)R版本后,可以通过键入以下内容来安装软件包:

install.packages("DT")

And then you should be able to load it by typing: 然后您应该可以通过键入以下内容来加载它:

library(DT)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM