dt

Select specific row of a datatable with a shiny widget

人走茶凉 提交于 2021-01-29 05:21:17
问题 I have the shiny app below in which the user clicks on a row and gets its index next to it. Is it possible to select the selected row with a pickerInput() which includes all the row names except of the selected one and when activated with a choice it will display the correspondent row and display its index as text. library(shiny) library(DT) library(shinyWidgets) shinyApp( ui = fluidPage( title = 'Select Table Rows', h1('A Server-side Table'), fluidRow( column(9, DT::dataTableOutput('x3')),

How to create a custom column (sortable) in DT::datatable

可紊 提交于 2021-01-28 19:07:37
问题 Let say I have below data-table - library(DT) d = data.frame( names = rownames(mtcars), date = as.Date('2015-03-23') + 1:32, time = as.POSIXct('2015-03-23 12:00:00', tz = 'UTC') + (1:32) * 5000, stringsAsFactors = FALSE ) datatable(d, filter = 'bottom', options = list(pageLength = 5)) Now I want to create a new column in the data-table by combining date+time+some-other-string as date_time . This new column date_time should be sortable based only on date part (not the time part nor string part

r - How to remove the horizontal line between the header and the body in a DT::datatable

别来无恙 提交于 2021-01-28 12:23:55
问题 I want to remove the stripes in te limit between de table data and the header, or at least, change its color. I want to make an schedule for teachers with their respective classroom. options = (list(pageLength = 40, dom = 't', ordering = FALSE, columnDefs = list(list(className = 'dt-center', targets = 0:5)), initComplete = JS("function(settings, json) {", "$(this.api().table().header()).css({'background-color': '#3b5998', 'color': '#ffffff', 'border-right': '1px solid #ffffff'});","}")) )) %>

formatStyle over multiple columns DT R

妖精的绣舞 提交于 2021-01-27 04:51:10
问题 I have a data.frame with one ID column and multiple numeric columns, the amount of numeric columns can differ. Of these numeric columns I want to color all values above the column mean green and all values below the column mean red. The code below give my desired outcome, but it is not a generic code for data frames with more or less numeric columns. library(DT) data2 <- cbind(ID = "some ID",iris[,1:4]) datatable( data2, rownames = FALSE, class = 'cell-border stripe', options = list( dom = 't

Format number into K(thousand), M(million) in Shiny DataTables

空扰寡人 提交于 2021-01-05 07:47:41
问题 I'm looking for a straight forward way to change the formatting of numbers into K,M in shiny dataTables. Preferably with something like formatCurrency . I don't want to write k, m functions to convert number into string in order to do the formatting as it makes it difficult to sort rows by value. 回答1: There's no built-in way to do this, but it's not too bad to write your own format function in JavaScript that doesn't break row sorting. See Column Rendering in the DT docs for how to do this:

Format number into K(thousand), M(million) in Shiny DataTables

跟風遠走 提交于 2021-01-05 07:47:04
问题 I'm looking for a straight forward way to change the formatting of numbers into K,M in shiny dataTables. Preferably with something like formatCurrency . I don't want to write k, m functions to convert number into string in order to do the formatting as it makes it difficult to sort rows by value. 回答1: There's no built-in way to do this, but it's not too bad to write your own format function in JavaScript that doesn't break row sorting. See Column Rendering in the DT docs for how to do this:

How to save edits made in DT while using SelectInput in correct position

帅比萌擦擦* 提交于 2021-01-04 08:10:11
问题 When using editable DataTable (package DT) where input is chosen by SelectInput the edits made isn't saved where it should be. Choosing a specific variable shows for example rows 50-60 from datatable in first rows. Editing them saves the edits on the first rows instead of in rows 50-60. In example below you can choose variable versicolor and delete setosa. Then edit Petal.Length to random number. Edit should be saved in row 51 but instead it is saved in row 1. I am thinking about a workaround

R -shiny- DT: how to update col filters

天大地大妈咪最大 提交于 2021-01-04 03:17:39
问题 I would like to use DT to allow the users to modify a dataset. However, when the factor cols change (by adding or removing a factor level) the corresponding table filter remains unchanged. In the following example: if I change a Species, the new Species does not appear in the filter dropdown list. Is there a workaround? Many thanks! library(shiny) library(DT) library(dplyr) iris2=iris %>% group_by(Species) %>% filter(Petal.Length==max(Petal.Length)) ui <- fluidPage( fluidRow(column(12,

R -shiny- DT: how to update col filters

安稳与你 提交于 2021-01-04 03:12:47
问题 I would like to use DT to allow the users to modify a dataset. However, when the factor cols change (by adding or removing a factor level) the corresponding table filter remains unchanged. In the following example: if I change a Species, the new Species does not appear in the filter dropdown list. Is there a workaround? Many thanks! library(shiny) library(DT) library(dplyr) iris2=iris %>% group_by(Species) %>% filter(Petal.Length==max(Petal.Length)) ui <- fluidPage( fluidRow(column(12,

R -shiny- DT: how to update col filters

大城市里の小女人 提交于 2021-01-04 03:12:41
问题 I would like to use DT to allow the users to modify a dataset. However, when the factor cols change (by adding or removing a factor level) the corresponding table filter remains unchanged. In the following example: if I change a Species, the new Species does not appear in the filter dropdown list. Is there a workaround? Many thanks! library(shiny) library(DT) library(dplyr) iris2=iris %>% group_by(Species) %>% filter(Petal.Length==max(Petal.Length)) ui <- fluidPage( fluidRow(column(12,