Questions tagged [dt]
DT is an R package that provides an interface to the JavaScript library DataTables. Use the data.table tag for questions related to the data.frame extension package data.table.
181
questions
44
votes
2answers
40k views
R Shiny set DataTable column width
I am trying to set the width of columns in a DataTable rendered in Shiny and am not able to implement it using the aoColumnDefs options. Has anyone tried this before ? My table has 1 text followed by ...
2
votes
2answers
3k views
R Shiny selectedInput inside renderDataTable cells
I search for solution to put selectedInputs in renderDataTable cells. I found js solutions: https://datatables.net/examples/api/form.html , however I do not know how to implement this solution in ...
17
votes
2answers
9k views
Shrink DT::dataTableOutput Size
I have a shiny interface, and I use DT::dataTableOutput and DT::renderDataTable a lot. However, I wonder if there's a way to shrink the datatable's size, e.g., making the font and the table smaller. ...
10
votes
2answers
6k views
R Shiny DT - edit values in table with reactive
Is it possible to update a reactive data source by editing the DT::DataTable? Below code is based on this code with change that x is made reactive. The problem starts when trying to change x in ...
6
votes
1answer
1k views
R Shiny, how to make datatable react to checkboxes in datatable
I would like my datatable to display content which depends on the status of checkboxes contained in the table. I have found help with both, including checkboxes in a DT as well as changing data table ...
14
votes
2answers
6k views
R shiny mouseover text for table columns
How can I create mouseover text for column names in R shiny data table display.
I'm trying to provide some text for users to understand the column names.
I checked in DT package also and I couldn't ...
53
votes
1answer
28k views
How do I suppress row names when using DT::renderDataTable in R shiny?
As per the explanation in section 2.3 here, I can remove rownames for a datatable by setting rownames = FALSE
How do I suppress row names when using DT::renderDataTable in R shiny? The following ...
20
votes
2answers
16k views
Hide certain columns in a responsive data table using DT package
I am trying to create a responsive data table for my shiny application using DT package. I want to hide certain columns in advance. For example:
library("shiny")
library("DT")
shinyApp(
ui = ...
5
votes
1answer
1k views
render dropdown for single column in DT shiny
I'm not proficient in Javascript and would like to replicate a dropdown function as is available in the rhandsontable package but for the DT package.
How could this be achieved in the most efficient ...
1
vote
3answers
860 views
Format a vector of rows in italic and red font in R DT (datatable)
A bit similar to this question: How to give color to a given interval of rows of a DT table?
but in my case I would like to let the user select rows in the table, then on click of a button deselect ...
1
vote
1answer
1k views
Pre-select rows of a dynamic DT in shiny
This question is the more dynamic version of this.
I have a DT in shiny app that could be empty at initialization. I'd like to pre-select all rows in DT. My first try is like this:
library(shiny)
...
34
votes
4answers
26k views
Remove 'search' option but leave 'search columns' option
I would like to remove 'global search' option from my application, but leave 'column search' option. Any ideas? I've tried different paramethers like searching=FALSE, filtering='none'... None of this ...
4
votes
1answer
75 views
DT apply background colour to cell based on separate data frame
I have a table to which I would like to apply background colours to individual cells. The colours have no obvious direct relationship with the data presented, and are specified in a separate data set.
...
9
votes
2answers
3k views
Shiny: Merge cells in DT::datatable
I would like to merge few rows in column in DT::datatable in shiny. Is it possible to do so?
Currently I am able to output which looks something like this:
But ideally I would like to merge the rows ...
7
votes
1answer
4k views
Total of a column in DT dataTables in shiny
I am trying to calculate the total of a column in my shiny app using DT::datatable. By total I mean the sum of all elements in a table not just what is showing in the current pagination. Following ...
5
votes
2answers
4k views
tooltip or popover in Shiny datatables for row names?
Iām stuck with trying to include something like a tooltip or popover with additional info when the user hovers over / clicks on the row names of a datatable, so they donāt have to look up some ...
2
votes
1answer
3k views
R - Download Filtered Datatable
I would like to be able to download a datatable after it is filtered using it's built in search. Either that or be able to filter a dataframe using the same kind of search used in a datatable and ...
1
vote
2answers
2k views
Include link to local html file in DataTable in Shiny
I want to include a link to a local html file, which lives inside the www directory of my shiny app, inside a column in data.table. On click a new tab should open showing the html file.
I've found ...
5
votes
2answers
7k views
Remove “Showing 1 to N of N Entries” Shiny DT
Issue:
I'm looking to remove the showing 1 to n of n entries field in shiny DT. Please see picture below of what I would like to REMOVE.
Any insight is much appreciated.
3
votes
1answer
1k views
R Shiny: Editing DT with locked columns
I am trying to have a DT that is editable by the user but I only want certain columns to be editable. Since this isn't a feature yet in DT, I am trying to hack it together by having the table refresh ...
1
vote
1answer
177 views
How to create a dropdown list in a Shiny table using datatable when editing the table?
I used RStudio to read in a csv file and used Shiny to build an app as an interactive table, the cell I selected right now as shown in the picture is pre-filled.
enter image description here
I want ...
13
votes
1answer
2k views
styleColorBar Center and shift Left/Right dependent on Sign
I am looking to create bars that when using DT's datatable appear in the middle of the cells of a column and reach out left or right depending on whether the value in the cell is positive or negative.
...
9
votes
2answers
8k views
How do I get the data from the selected rows of a filtered datatable (DT)?
The DT package allows you to get the indices of selected rows using input$tableID_rows_selected. This works great for tables that do not have filtered data. However, if we have a filtered dataset, we ...
7
votes
2answers
792 views
DataTables apply column formatting to filter also
When creating a datatable with filter = 'top' and also using a formatting function on a column, the formatting isn't applied to the filter control for that column. Is there a way to format the filter ...
5
votes
1answer
2k views
Shiny: use styleColorBar with data from two data frames
I am trying to display a table in Shiny, where numbers will be displayed from one data.frame (or data.table), but the size of bars will be taken from another data.frame. For instance, absolute values ...
8
votes
1answer
3k views
R shiny DataTables ColVis behavior
I got an RStudio Shiny server page with DataTables, and I got TableTools and ColReorder working in the example below, but ColVis (Show/hide columns button) is not behaving in the same way as the ...
8
votes
3answers
5k views
Button extension to download all data or only visible data
With the button extension to DT package, is there a way to specify that the buttons download either (1) all the data feeding the datatable, or (2) only the data on the visible page.
Below is the ...
5
votes
2answers
3k views
Render datatable with sparklines in Shiny
I want to include sparklines in a shiny DT. It works fine in the RStudio viewer but in Shiny the sparklines are not rendered. Here is a minimal example.
# dependencies
require(sparkline)
require(...
3
votes
1answer
795 views
Shiny widgets in DT Table
I'm trying to include shiny widgets such as textInput, selectInput (single), sliderInput, and selectInput (multiple) in the rows of a DT table. When the widgets are directly on the page, they display ...
10
votes
3answers
9k views
Add comma to numbers every three digits in datatable (R)
Suppose my data looks like this:
df1 = data.frame(A=c(1000000.51,5000.33), B=c(0.565,0.794))
I want to use DataTables and have column A be (1,000,001 ; 5,000)
library(DT)
datatable(df1) %>% ...
4
votes
1answer
4k views
How to use an editable DataTable in Shiny as input for another DataTable
I want the user to be able to edit the already-loaded DataTable, click a button and then have the edited version used as input to do stuff. So in this example, how could I make the new user-edited ...
1
vote
2answers
9k views
shiny allowling users to choose which columns to display
I am dabbling with the datatable feature in shiny and I am interested in creating a wellpanel or a sidepanel that lists all the columns of a datatable and allows users to choose which columns they ...
9
votes
1answer
2k views
R Shiny: How to add data tables to dynamically created tabs
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 ...
8
votes
1answer
2k views
Edit datatable in Shiny with dropdown selection for factor variables
I am trying to create a Shiny app that allows users to edit a datatable, whereby the edits are saved. Here is a minimal example:
library(shiny)
library(DT)
ui <- fluidPage(
DT::DTOutput('df')
)
...
6
votes
3answers
3k views
How To Add totals to a DT::datatable?
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:
"...
2
votes
1answer
619 views
dateInput not working on DT in shiny
I'm trying to create a DT with several inputs in Shiny. The columns with selectInput and numericInput work fine, but the one with dateInputs doesn't. It's like the input$date_n does not exist at all.
...
12
votes
1answer
10k views
How to hide a column using the DT package - columnDefs parameter doesn't work
I would like to hide a column (col4 in example below) in a dataframe using the DT package.
I've incorporated the code snippet found here, to no avail - col4 still shows. Here is my sessionInfo, ...
5
votes
1answer
5k views
Conditional formatting in DT Data Table R Shiny
I have a table with 5 cols and 1st column as character and other four as numeric. I am using DT Data Table to display the same in Shiny App. Now, I need to compare each of the four cols for each row ...
4
votes
1answer
695 views
Merge columns in DT::datatable
I need to merge cells across columns in a DT::datatable in shiny. The best way seems to make use of the Javascript DataTables extension RowGroup. But I don't know which steps to take from viewing the ...
3
votes
1answer
2k views
Ordering factors in data table using DT package
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 ...
0
votes
2answers
1k views
Display cell value in tooltip after hovering over a cell in DT::datatable
How do I utilize javascript to display the cell value in a tooltip after hovering over a particular cell in a DT::datatable? I decided to hide the long text after a certain width is reached (overflow-...
7
votes
1answer
2k views
Adding an image to a datatable in R
I'm trying to add an image to a datatable in R form the DT package. I fount this question: How to embed an image in a cell a table using DT, R and Shiny and it works for the image that's online. But ...
5
votes
1answer
887 views
Image popup on hover in DT in R
I have a DT within a Rmarkdown and I would like an image to pop up when hovering over table data.
What i have so for seems to work but it distorts the datatable.
It increases the table rows height ...
5
votes
2answers
3k views
how to render DT::datatables in a pdf using rmarkdown?
How can I display DT::datatable objects from a rmarkdown script onto a pdf document? My code so far is breaks down with the following error:
processing file: reportCopy.Rmd
output file: reportCopy....
4
votes
1answer
827 views
gvisTables not rendering in Shiny apps
The actual issue I'm trying to solve: I'm creating a dashboard which will include data tables. I would like for numbers to be formatted with commas as thousands separators, but there is (apparently) ...
3
votes
1answer
490 views
R Shiny - Disabling specific rows in a datatable with column sorting
The app below contains a datatable of the iris dataset with row selection enabled. I would like to disable selection for the first 3 rows specifically. I can do this using the solution posted here. ...
3
votes
1answer
1k views
R shiny mouseover to all table cells
How I can achieve mouse hover text for all table cells (not for column names).I am having the datatable with 3 columns. On hover over the cell of 3rd column, need to display the combined contents of ...
3
votes
1answer
214 views
render dropdown for single column in DT shiny BUT loaded only on cell click and with replaceData()
Goal
To have select dropdown in DT datatables not at the building of the datatable but built on cell click, with replaceData() and with the datas on RDBMS (SQL Server).
When I click on the selected ...
2
votes
1answer
2k views
R datatable buttons export with formated cells
The extensions Buttons works great for shiny application, from library(DT). However it export the data without formatting. Is there a way to export data with format (e.g. percentage, or currency)? ...
1
vote
1answer
59 views
Batch searching regex in Shiny DT datatables with spaces (not pipes)
Following on from this post can anyone please tell me if it's possible to implement a way to search an interactive Shiny DT datatable where keywords are separated by spaces and not pipes? Users of my ...