dt

shiny allowling users to choose which columns to display

僤鯓⒐⒋嵵緔 提交于 2019-12-18 18:25:12
问题 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 want to see on the datatable. Right now this code below displays all the columns of toy dataset mtcars library(shiny) runApp(list( ui = basicPage( h2('The mtcars data'), dataTableOutput('mytable') ), server = function(input, output) { output$mytable = renderDataTable({ mtcars }) } )) I am interested

Format a vector of rows in italic and red font in R DT (datatable)

女生的网名这么多〃 提交于 2019-12-17 20:33:21
问题 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 the rows, and turn the previously selected rows that are now part of the list of rows submitted for removal grayed out font (color: light gray) and in italic. This to indicate that these will be excluded from further analysis. Secondly a button to undo the entire selection should change all rows

R Shiny set DataTable column width

泄露秘密 提交于 2019-12-17 07:25:42
问题 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 3 numeric columns. The numeric columns need to be narrower and the 1st column (text) wider. output$result <- renderDataTable({ z <- as(dataInput(), "data.frame") setnames(z, c("Rules", "Support", "Confidence", "StatDep")) z }, options = list(aLengthMenu = c(5, 30, 50), iDisplayLength = 5,

Add label to sparkline plot in datatable

允我心安 提交于 2019-12-14 04:19:31
问题 Is it possible to add a custom label to a sparkline plot? For example, in the code below, I would like to label each bar with the corresponding letter in the label column. Building from a previous [answer] require(sparkline) require(DT) require(shiny) require(tibble) # create data spark_data1<-tribble( ~id, ~label,~spark, "a", c("C,D,E"),c("1,2,3"), "b", c("C,D,E"),c("3,2,1") ) ui <- fluidPage( sparklineOutput("test_spark"), DT::dataTableOutput("tbl") ) server <- function(input, output) {

keep selected rows when changing dataset in shiny DT datatable

前提是你 提交于 2019-12-14 03:53:05
问题 I am using the DT package to display a data table in my shiny app. Since I provide different data sets, I have radio buttons to select them and the data table updates automatically. What I would like to do is to preselect the available rows from df1 in df2 when switching the datasets. At the moment, my selection always get erased. When I try to save the selected rows (uncomment the two rows), my table get reset directly. library(shiny) library(DT) df1 <- data.frame(names=letters, values=1:26)

Include sparkline htmlwidget in datatable cells in a Shiny app, without resorting to (much) JavaScript

狂风中的少年 提交于 2019-12-14 03:42:34
问题 I am using the sparkline package to produce bar charts to place into cells of a datatable in a Shiny app. I've managed to produce the desired output in a standalone datatable , but when I place it into the Shiny app it doesn't work. It may have something to do with how spk_add_deps() identifies the htmlwidgets. I've tried moving the spk_add_deps() function around quite a bit and passing it various identifiers, and nothing worked. I did find essentially the same question here Render datatable

Diplaying activity details in a data table in R shiny

无人久伴 提交于 2019-12-14 03:32:22
问题 When I run this R shiny script below, I get two plots with a chart for activity path derived from the patients dataset of the bupaR library called trace explorer on the left and a data table to display the activity/trace details. The chart on the left is such,that we observe various paths with sequence of horizontal traces of activities which occur one after the other. When clicked on any box in a particular trace, the trace details are presented on the right table. My requirement is that,

Error :Result must have length 12813, not 0?

落花浮王杯 提交于 2019-12-14 03:29:59
问题 I was asked to do the coding project for a job as an intern in a company but I wasnt able to complete it. However I didn't get the job I wanted to just complete the thing . The error that arrives is: Error :Result must have length 12813, not 0 Here is my code: library(shiny) library(dplyr) stock<-read.csv("thafinal2.0.csv") ui <- fluidPage( dateInput(inputId = 'date1',label = 'Start',value = "2017-08-20"), dateInput(inputId = 'date2',label = 'Stop',value = "2018-08-20"), tabPanel("stock", DT:

Rmarkdown and DT: result do not render

人盡茶涼 提交于 2019-12-14 02:05:46
问题 Do you know how to render this in Rmarkdown? ```{r, results='asis'} library(DT) obj <- data.frame(B=as.numeric(1:18), C=as.factor(c("A","B","C")), stringsAsFactors=FALSE) obj <- split(obj, obj$C, drop = TRUE) lapply(obj, function(x) { datatable(x, filter = 'top', options = list( pageLength = 12, autoWidth = TRUE)) } ) ``` DT tables render in the Viewer of RStudio but cannot have the splitted tables in the .Rmd.. what am I missing? 来源: https://stackoverflow.com/questions/33343241/rmarkdown-and

Hide HTML code inside datatable edit when formatting the table with formattable

僤鯓⒐⒋嵵緔 提交于 2019-12-13 18:05:08
问题 I'm using formattable and DT together in order to create a custom table, while still being able to edit the cell values (using editable=T , from DT ). The problem is that if I use formattable() to make a custom table, whenever I double click on a cell to edit its content, it will show the HTML code instead of the simple value. Here an example: library(formattable) library(DT) products <- data.frame(id = 1:5, price = c(10, 15, 12, 8, 9), rating = c(5, 4, 4, 3, 4), market_share = percent(c(0.1,