dt

How to edit column names in datatable function when running R shiny app?

一曲冷凌霜 提交于 2021-02-04 16:46:34
问题 I'm using datatable function from DT package in R Shiny and I want that the user of my app can edit the column names (the variable names). Is there any option to do that? For now I'm using a text input "old_var_name", a text input "new_var_name" and an actionbutton "update_variable_name". But at this point, I'm only able to change on variable name at the time. I want the user to be able to change as much as variable names he wants. Server: tab <- eventReactive(input$import,{ inFile <- input

DT::datatable() export to pdf while preserving HTML </br> for multiline cells

假如想象 提交于 2021-01-29 18:08:05
问题 Trying to use DT::datatable() in R to export a table with multiline cells to pdf. DT::datatable() works perfectly for multiline cells, but problems arise when trying to export to pdf. I’ve tried two different approaches, each with their own problems. There are very many threads about keeping formatting when exporting to pdf, but none about exporting multiline cells. Approach 1: The pdf print button of the Buttons extension with the arguments escape = FALSE and exportOptions = list(stripHtml =

Modify boxplot using sparkline package

风格不统一 提交于 2021-01-29 15:50:31
问题 I am using the sparkline package to insert the boxplot into the DT table rows. I trying to modify the boxplot and add additional information on it. Now boxplots look like this: But I want to display more information on them, for example: for A add values: (4,8,22) for B add values: (5,15,22) The desired output should look something like this: I was trying to use help from here and here but can't figure it out. Code: library(dplyr) library(sparkline) library(DT) df <- data.frame("Type" = c(rep

Replacing initial Dataframe from an editable DataTable and using that new data frame in another table

你。 提交于 2021-01-29 12:32:15
问题 I have a nested DataTable in my Shiny app. Some of the columns in the child table are editable by the user. The goal here is to have the user edit the values and then the data frame would be replaced with those new values. Then I would like to take that replaced data frame and use it for another table. I need to use the edited values for calculations in the other table. workflow : create nested data table -> user edits values -> initial data is replaced by new data -> use the new data for

Choose a datatable row either by clicking, actionButton() or shiny widget

怎甘沉沦 提交于 2021-01-29 12:30:35
问题 I have the shiny app below in which the user is able to choose a row to display its index with 3 ways. Click on the row and display its index Click on a row then press Next and display the index of the next row. Select the rowname of a row,press Assign and display its index. I know that I can use callback in order to enable datatable to achieve this but I do not know how to combine many callbacks . library(shiny) library(DT) dat <- mtcars callback <- JS( "Shiny.addCustomMessageHandler(", "

Toggle hide/show child rows in datatable (without shiny)

和自甴很熟 提交于 2021-01-29 10:15:53
问题 I want to create a datatable from this dataframe: df1 <- data.frame( brand = c("Brand 1", "Subbrand 1.1", "Subbrand 1.2", "Brand 2", "Subbrand 2.1", "Subbrand 2.2"), sales = 100 * 1:6 ) The brands should be parent rows and the subbrands child rows which should be hidden in the beginning. On click on a parent rows its subbrands should be shown. This must work without shiny as I want to integrate it into a HTML-flexdashboard. I think to solve this I will need a callback like in this example but

Vertical alignment of numericInput in DT

大憨熊 提交于 2021-01-29 09:49:54
问题 I've been trying to vertically align the elements inside a dataframe rendered by dt, to do this I used the className = "dt-center" arguments inside the options of the datatable function, while this works for most of the elements of my dataframe, it does not center the numericInput inside it. I tried to use the "vertical-align" = "middle" css argument with the formatStyle function, but this does not change the alignment of the numericInput either. Would there be a way to align these

Editable calculation with DT table in Shiny

天涯浪子 提交于 2021-01-29 08:47:50
问题 I've been at this for awhile and have read a bunch but I still can't wrap my head around how to make this work. Is there a simple solution? I want to edit a DT table in my shiny app and, upon editing, I'd like there to be a change in a column that aggregates two values. Here is an example: library(tidyverse) library(shiny) library(DT) mt <- mtcars %>% select(mpg, cyl) %>% head() ui <- fluidPage( DTOutput(outputId = "final_tbl") ) server <- function(input, output){ dat <- reactive({ d <- mt %>

Add a new row to a dataframe by clicking on a datatable row and actionbutton

白昼怎懂夜的黑 提交于 2021-01-29 08:46:47
问题 I have the shiny app and the dataframes below. When I click on a row I get a text which displays the similarity of this attribute_name with a . If I click Next I get the similarity of the same attribute_name with the next candidate_2 . I want to be able to press the Add actionbutton() and add this candidate_2 to the related selectInput() in the table. For example if I click on the 1st row of the table and press Add the word micro will be added in the selectInput() of the first row. Basically

Issue in action button

狂风中的少年 提交于 2021-01-29 07:03:26
问题 The code below has action button in rendered in html. But when i click the button in second row(id as "ang") there is no modal box showing up. Can anyone help me? Not sure why this logic is not working.. If I put a normal button, it is working library(shiny) library(shinydashboard) library(DT) number_compare <- data.frame(replicate(2, sample(1:100, 10, rep=TRUE))) # number_compare$direction <- ifelse( # number_compare$X1 < number_compare$X2, # as.character(icon("angle-up")), # as.character