dt

How to add custom button in R Shiny datatable?

只谈情不闲聊 提交于 2019-12-23 04:56:14
问题 There is an option to add a custom button on datatables.net site. How it can be coded in R Shiny app? A basic R code example for one button and observer will be great to see. Here is JS code from https://datatables.net/extensions/buttons/examples/initialisation/custom.html $(document).ready(function() { $('#example').DataTable( { dom: 'Bfrtip', buttons: [ { text: 'My button', action: function ( e, dt, node, config ) { alert( 'Button activated' ); } } ] } ); } ); Thanks ! 回答1: You don't need

R Shiny: Mouse Hover Text for Datatable Rows

最后都变了- 提交于 2019-12-23 02:52:10
问题 Is there a way to display mouseover text upon hovering over a row (record) in datatable display? After going through some similar questions on StackOverflow, I found 2 example codes, one that displays hover text for a column cell and one that highlights the entire row on mouse hover. Example code for displaying column cell hover text: library(shiny) library(DT) shinyApp( ui = fluidPage( DT::dataTableOutput("table2") ), server = function(input, output) { output$table2<-DT::renderDataTable({

Ordering factors in data table using DT package

♀尐吖头ヾ 提交于 2019-12-22 10:37:40
问题 I have data that I want to display in 5% increments, such as 5-10%, 10-15%, etc. To do this, I have a data frame that stores them as a factor, with the levels being the midpoint of the range, and the label being the range to display. For example, the level 12.5 would be labeled 10-15%. However, I'm having trouble sorting this correctly using a datatable. library('DT') example <- data.frame(name = c('A', 'B', 'C', 'D'), value = factor(c(7.5, 12.5, 7.5, 17.5), levels = c(7.5, 12.5, 17.5),

Adding radiobutton to select a DataTable row in Shiny

青春壹個敷衍的年華 提交于 2019-12-22 09:39:23
问题 I need to add radiButtons to select rows in Data, i.e. the radiobutton choosen should be passed to input. I cannot use built in row selection in DT. I really need to use radiobuttons to select the row. This is what is wanted: Using https://yihui.shinyapps.io/DT-radio/ I am able to select COLUMNS. Es: library(shiny) library(DT) shinyApp( ui = fluidPage( title = 'Radio buttons in a table', DT::dataTableOutput('foo'), verbatimTextOutput("test") ), server = function(input, output, session) { m =

Background color of DT::datatable in shiny

微笑、不失礼 提交于 2019-12-22 07:06:04
问题 How do I change the background color of a selected row of a datatable in a shiny application? My ui.R has the following code: library(shinydashboard) header <- dashboardHeader(title = 'title') sidebar <- dashboardSidebar( sidebarMenu( menuItem('dashboard', tabName = 'dashboard', icon = icon('dashboard')) ) ) body <- dashboardBody( fluidRow( column(width = 6, box( title = 'box', width = NULL, status = 'primary', DT::dataTableOutput('table1') ), box( title = 'box', width = NULL, status =

Shiny DataTable: Save full data.frame with buttons extension

牧云@^-^@ 提交于 2019-12-22 05:13:36
问题 I am using DataTables with Shiny. With the buttons extension a user can download or print the data in the datatable. But only the visible part of the rows is downloaded/printed. I want to change that behaviour, so that the full data.frame with all rows can be downloaded. Is this possible with the buttons extension or do I have to switch to a downloadHandler? library(DT) library(shiny) df <- data.frame(a = 1:100, b = 1:100) ui <- fluidPage( dataTableOutput("table") ) server <- function(input,

How To Add totals to a DT::datatable?

做~自己de王妃 提交于 2019-12-21 18:04:08
问题 I am trying to add totals to a data table footer. Using code from different sources, I wrote the following application using Shiny. The problem is, when I run it, the following message appears: "Processing ..." and stays there forever. My guess is the JS() code, but cannot debug that. library(shiny) library(DT) library(htmltools) ui <- fluidPage( fluidRow( column(9, DT::dataTableOutput('withtotal')) ) ) server <- function(input, output, session) { # server-side processing mtcars2 = mtcars[, 1

R Shiny: How to add data tables to dynamically created tabs

白昼怎懂夜的黑 提交于 2019-12-21 11:35:33
问题 I am currently trying to create dynamically-created data tables that each have its own tab. The number of tabs is determined by the user. I have used the code from this post as a framework. I am able to create the tabs dynamically, but I can't figure out how to add data tables to the tabs. The data tables are determined by user input too. So, for example, say in ui.R, the user has the choice to pick which data sets they want to see: ui.R library(shiny) shinyUI(fluidPage( titlePanel("Example")

Delete row of DT data table in Shiny app

断了今生、忘了曾经 提交于 2019-12-21 05:16:47
问题 I have a shiny app that displays data frame data in a DT table. In the app I have a button that I when clicked will delete the selected rows. It works the first time I select rows and click the delete button but after clicking again the wrong rows are deleted and any previously deleted rows reappear. I'm assuming this is because it reloads the data frame (from a csv) when I call DT::renderDataTable() . How can I re render the table after deleting a selected row from the the data frame? 回答1:

Extract filters from R Shiny Datatable

廉价感情. 提交于 2019-12-21 04:39:25
问题 I have a DT data table in R Shiny and I have enabled column filtering by setting filter="top" within renderDT() . I now want to extract the user-applied filters so I can save them in variables server-side and reapply them when -- for instance -- a database is updated, requiring an update of the table. Here's a MWE using Shiny Dashboard: library(shiny) # Shiny web app library(shinydashboard) # Dashboard framework for Shiny library(plotly) # Plotly interactive plots library(DT) ui <-