简体   繁体   中英

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! My DT version is 0.1, and i cannot update it to github version . I have tried many approaches, first via devtools::install_github('rstudio/DT') but i got an error

...--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

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) ...

This is very necessary and important option which i need for DT, is there anyway i could get it done?

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. Depending on the user preferences for filtering, lets assume it gives us 550 rows (but it can give us more or less than that). 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). Is there any way to get all found rows after filtering datatable (not depended on 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. 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.

If you downgrade your R version to an older one it should work (it works fine for me on Version 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.

Once you install the old(er) version of R, you can install the package by typing:

install.packages("DT")

And then you should be able to load it by typing:

library(DT)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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