dt

Programmatically color format numeric columns in a datatable

微笑、不失礼 提交于 2019-12-11 09:32:09
问题 I am looking to color format each numeric column so that it shows a blue range bar depending on the range of each column. Here is a photo on what I am trying to achieve. #Here is the the table I have so far. #I am adding filters to the columns. This works great library(DT) library(magrittr) df = datatable(iris, filter = 'top', options = list(pageLength = 5, autoWidth = TRUE)) #I try to add the blue bars here to the first 2 numeric columns df %>%formatStyle(names(df)[1:2], background =

Styling the expand row button in DT in shiny R

≡放荡痞女 提交于 2019-12-11 08:59:05
问题 I'm trying to style the expand rows button available in DT. The styling is available here. The code I'm using for creating the datatable is- library(DT) datatable( cbind(' ' = '⊕', mtcars), escape = -2, options = list( columnDefs = list( list(visible = FALSE, targets = c(0, 2, 3)), list(orderable = FALSE, className = 'details-control', targets = 1) ) ), callback = JS(" table.column(1).nodes().to$().css({cursor: 'pointer'}); var format = function(d) { return '<div style=\"background-color:#eee

embed select input in DT generated from another DT with cell selection

ぐ巨炮叔叔 提交于 2019-12-11 06:21:24
问题 I have a first DT table oTable with cell selection enabled. When the user click (select) a cell, that will generate another DT table nTable . Then, in nTable I want to insert a selectInput . The code below is a working example. Mostly adapted from this post. Problem: When nTable is regenerated, the connection (binding?) with shinyValue is somehow broken. Step to reproduce the problem: launch the app. select top left cell (e.g. Sepal.Length=5.1). In fact, select any cell will also work. In the

Exporting only Selected Rows from DT

£可爱£侵袭症+ 提交于 2019-12-11 05:59:00
问题 I'm using R's DT in a FlexDashboard. I have the export buttons working, but I'd like to be able to make the exports export only the data that is either selected via rows or when using the DT search function. I've looked at the DT manual, but it hasn't clarified how I'd go about it. datatable( dept_table, rownames = FALSE, extensions = "Buttons", options = list( searching = TRUE, pageLength = 200, scrollX = TRUE, scrollY = TRUE, dom = "BRSpfrti", buttons = c('copy', 'csv', 'excel', 'pdf',

How to change to 24 hour format in datatables in R Shiny

半世苍凉 提交于 2019-12-11 05:48:48
问题 Just like most people, time date format is also not my favorite topic in R, and is once again giving me more trouble than I bargained for. In follow-up of this question: SO I got rid of the 'T' and 'Z' with 'toLocaleString' but now my datatable is showing times in AM and PM, while I just want to see the original 24h times. I'm running the app in google chrome, and my output looks like this at the moment: library(shiny) library(DT) data <- structure(list(DATUM = structure(c(1490738402,

Is it possible to add tickboxes in a DT datatable?

余生颓废 提交于 2019-12-11 03:02:42
问题 I would like to ask if it is possible to add a column with tickboxes in a DT datatable. I tried to use rep(TRUE,5) which works for rhandsontable but not for DT . library(DT) datatable( data.frame(Sel. = rep(TRUE,5), Label=paste("Test",as.integer(1:5)), Marg=rep(5), Avail.=as.integer(rep.int(5,5)), Sel =as.integer(rep.int(5,1)), stringsAsFactors = FALSE)) 回答1: Yes, it's possible. We can use the datatable extension Select for that (see here for details). Here is a minimal RMarkdown example: ---

date format change with DT and shiny

时光毁灭记忆、已成空白 提交于 2019-12-10 18:13:27
问题 my problem is when i use datatable on my computer and on the server formatDate is changing i know i'm using method = 'toLocaleDateString' maybe it's not the good method on my computer it give me the format i want : 1 février 2000 21 mars 2000 on shiny it give me : 01/02/2000 21/03/2000 local computer and server have Sys.timezone() [1] "Europe/Paris" im trying to do it like this a <-structure(list(timestamp = structure(c(949363200, 953596800, 961286400, 962582400, 965347200, 969667200), class

shiny ,DT, styleColorBar different color for positive and negative values?

房东的猫 提交于 2019-12-10 18:01:35
问题 I've read the DT.pdf doc and searched, but it seems like different colors is not supported by DT package. How could I achieve the effect shown in the image link below? Thanks! example: different colors for positive and negative values 来源: https://stackoverflow.com/questions/32830382/shiny-dt-stylecolorbar-different-color-for-positive-and-negative-values

DT in Shiny: Change only the colour of a single row

余生长醉 提交于 2019-12-10 14:23:31
问题 I have a dataset: ID Value 102 306 41 800 101 783 105 193 myID 334 I would like to draw this up as a datatable where only the row with 'myID' is coloured orange and the rest of the table is blue. Having looked at the helper functions and other examples, it seems that I should be using styleEqual. However, I don't know what the values in my other rows are, and also they will change dynamically. I tried using datatable(tableData) %>% formatStyle(0, target= 'row',color = 'black', backgroundColor

How to use serverside processing in DT::datatable?

懵懂的女人 提交于 2019-12-10 14:23:31
问题 I am using DT::datatable() to visualize tables in a R markdown file. # R markdown file library(DT) ```{r viewdata} # this is an example but my actual dataset has 10000 rows and 100 columns var.df <- data.frame(x = rnorm(1:10000), y = rnorm(1:10000),...) DT::datatable(data = var.df) ``` When I run this code, I get a warning and the resulting HTML is very slow to load: DT::datatable(var.df) Warning message: In instance$preRenderHook(instance) : It seems your data is too big for client-side