dt

Using Plotly with DT via crosstalk in Shiny

梦想的初衷 提交于 2019-12-06 05:28:32
I am writing an app to read a csv file into shiny and link a plotly scatter plot with a DT table. I pretty much followed the example from the Plotly website on DT datatable ( https://plot.ly/r/datatable/ ) with the exception that the saved data from the csv is saved as a reactive input and that I have selectinput for the x and y variables for the scatterplot. I can generate the plot and DT table after clicking on the action button and I can also update the DT to only show selected rows from brushing the scatterplot. My problem is that when I select rows in the DT, then the corresponding

Ordering factors in data table using DT package

我的未来我决定 提交于 2019-12-06 02:42:09
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), labels = c('5-10%', '10-15%', '15-20%'))) datatable(example, rownames = FALSE, options = list(order = list(1

Adding radiobutton to select a DataTable row in Shiny

删除回忆录丶 提交于 2019-12-06 01:44:24
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 = matrix( c(round(rnorm(24),1), rep(3,12)), nrow = 12, ncol = 3, byrow = F, dimnames = list(month.abb,

Update row(s) of a Shiny DataTable while maintaining position

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 23:07:33
问题 I am creating a Shiny app that displays data.frame information at the top of the screen and specific variable stats at the bottom. The user can navigate the data.frame columns by interacting with a DT::datatable object. When a user clicks on a variable, detailed information is presented that can be edited. I would like this information to be updated and reflected in the datatable. My problem is that when I update the table, it is rendered and shown starting at the very beginning. How can I

How to avoid mixup between rowcallback and sorting in datatable

 ̄綄美尐妖づ 提交于 2019-12-05 14:57:14
With the help of a previous question , I can now style selected rows (intended for the user to select rows to be excluded from further analysis), but I have found out that sorting the datatable after executing the functionality to exclude rows (gray them out and add a different icon, keeps the icon in the correct row, but grays out the wrong rows. here is the table after deselecting rows 2,3 and 4 before sorting: and after sort: (with the crosses at the right rows, but the graying out not. library(shiny) library(DT) mtcars <- as.data.table(mtcars[1:15, ) ui <- fluidPage( # actionButton(

Shiny DT: Freeze rownames while sorting?

白昼怎懂夜的黑 提交于 2019-12-05 11:57:43
I'm designing a Shiny app to rank people based on a variety of metics. Using the DT sorting feature, I want users to be able to click on any column and sort by it. It seems natural to use the rownames as the rank; the problem is that these numbers sort along with the rest of the table. Is there any way to freeze this column so the rank numbers stay the same while the rest of the table sorts? Perhaps with a JavaScript function? EDIT: In the example below, when I click "Metric_1," I want the rownames to stay 1, 2, 3, 4, instead of sorting to 3, 2, 1, 4 to match the new order of Person C, Person

Highlight Predefined Words in Shiny DT table [Not through Search Highlight] [closed]

泄露秘密 提交于 2019-12-05 09:34:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm creating a shiny application and I want to highlight certain predefined words in DT table in shiny. I'm aware of the search highlight feature in DT. For example: datatable(mtcars2, options = list(searchHighlight = TRUE, search = list(search = 'da'))) I want to highlight like the previous example but not from a

Background color of DT::datatable in shiny

孤者浪人 提交于 2019-12-05 08:56:48
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 = 'primary', DT::dataTableOutput('table2') ) ), column(width = 6, box( title = 'box', width = NULL, status =

Conditional formatStyle in DT

有些话、适合烂在心里 提交于 2019-12-04 16:48:52
I want to color rows in column A by values in column B. The code below is based on the example from the vignette Link , but shows only the condition for two columns: mobile_number by mobile_flag. Data: head(test[, c("EMBG","mobile_number", "home_number", "mobile_flag", "home_number_flag")]) EMBG mobile_number home_number mobile_flag 1 101001455126 075-201-543 02/2446-275 correct 2 101010455015 55555555555 55555555555 incorrect 3 101014455095 0 0 incorrect 4 101947455134 075/482-356 02/2460-020 correct 5 101952450264 070 22 16 18 ---------------- correct 6 101953450012 0 02/2446-276 incorrect

Create a table with clickable hyperlink

青春壹個敷衍的年華 提交于 2019-12-04 16:28:35
I have an R data frame, which is displayed on RShiny output called by renderDataTable. However, I am unable to implement a simple Java or html tags that helps me to do the following. Example: (I am inserting the server.ui code, considering that these parameters are to be set at server.ui end. ) For simplification representing only 2 rows. mydataframe Col1 Col2 Col3 Google 5 lines description www.google.com Yahoo 5 lines description www.yahoo.com Goal is to rederDataTable output on shiny so that, "Google" and "Yahoo" are clickable labels, with their links (Col3) saved into them. Thereby,