logo
down
shadow

Flexdashboard, rhandsontable: how to programmatically access user updated table?


Flexdashboard, rhandsontable: how to programmatically access user updated table?

By : user2173530
Date : October 20 2020, 08:10 PM
I hope this helps . Not a Shiny programmer. Simple question. rhandsontable in Flexdashboard app. How to access a column updated by the user? Sample code: , you can use hot_to_r as in
code :
modified_table <- reactive({
  hot_to_r(req(input$table_id)) ## req!
})
output$table_id <- renderRHandsontable({ 
  rhandsontable(initial_table) ## need to call converter
})
library(shiny)
library(rhandsontable)

ui <- fluidPage(
  rHandsontableOutput("table_id"),
  tableOutput("second_table")
)

server <- function(input, output, session) {
  initial_table <- head(iris)

  output$table_id <- renderRHandsontable({
    rhandsontable(initial_table) ## need to call converter
  })

  modified_table <- reactive({
    hot_to_r(req(input$table_id)) ## req!
  })

  output$second_table <- renderTable({
    modified_table()
  })
}

shinyApp(ui, server)


Share : facebook icon twitter icon
Programmatically change user permissions for table Access database

Programmatically change user permissions for table Access database


By : Arnab Ghosh
Date : March 29 2020, 07:55 AM
it fixes the issue @HansUp sugestons helped. Finnaly, I added Jet OLEDB:System Database property to my OleDb connection string and it works. Even it works without GRANT command.
I have created a table using rhandsontable function now how can I update the table on submit button?

I have created a table using rhandsontable function now how can I update the table on submit button?


By : muhajr
Date : March 29 2020, 07:55 AM
To fix this issue As far from what I can understand you want to access the input of your rhandsontable inside your server when you press the submit button. In the example below I have modified your code so that I display the updated rhandsontable in tableoutput.
code :
library(shiny)
library(rhandsontable)

ui <- fluidPage(

  # Application title # titlePanel("Old Faithful Geyser Data"),

  mainPanel(
    rHandsontableOutput('table'),
    br(),
    submitButton("Apply changes"),
    verbatimTextOutput('selected'),
    ##The updated table output
    rHandsontableOutput('tableoutput')
  )
) 


server <- function(input, output) {
  data1 = read.csv("SampleCSVFile_2kb.csv", TRUE,",")


  output$table = renderRHandsontable(rhandsontable(data1, width = 1000, height = 250))

  output$selected=renderPrint({
    cat('\nChanged Cell Old Value:',input$table$changes$changes[[1]][[3]])
    cat('\nChanged Cell New Value:',input$table$changes$changes[[1]][[4]])
  })

   observe(
     if(!is.null(input$table)){
       output$tableoutput = renderRHandsontable(rhandsontable(hot_to_r(input$table), width = 1000, height = 250))


     }
   )

}


shinyApp(ui = ui, server = server)
r shiny: updating rhandsontable from another rhandsontable

r shiny: updating rhandsontable from another rhandsontable


By : PRINCE JOHNSON
Date : March 29 2020, 07:55 AM
With these it helps Allowed date formats in rhandsontable
The first problem is the format of the date column. It seems like POSIXct is not allowed here. According to the github documentation of rhandsontable, Date as in Sys.Date() is recommended. So replacing
code :
date.range <- as.POSIXct((seq(start.date,end.date,by="day")), origin = "1970-01-01")
date.range <- as.Date((seq(start.date,end.date,by="day")), origin = "1970-01-01")
library(shiny)
library(rhandsontable)

channel <- c("TV","Radio","Digital")
start.date <- as.Date("2017-01-01")
end.date <- as.Date("2017-01-07")
date.range <- as.Date((seq(start.date,end.date,by="day")), origin = "1970-01-01")
date.range <- as.data.frame(date.range)
colnames(date.range) <- c("date")
date.range[channel] <- 0
table1 <- date.range
table2 <- date.range
#Define the tables.

ui <- fluidPage(
  br(),
  fluidRow(
    column(4, rHandsontableOutput("table1output")),
    column(4, rHandsontableOutput("table2output"))
  ))

server <- function(input,output,session){
  table <- reactiveValues()
  table$table1 <- table1
  #DEFINE ONLY TABLE1

  output$table1output <- renderRHandsontable({rhandsontable(table$table1)})
  output$table2output <- renderRHandsontable({rhandsontable(table$table1)})
  #rhandsontable outputs

  observeEvent(input$table1output,{
    df <- hot_to_r(input$table1output)
    df <- as.data.frame(df)
    table$table1 <- df
  }, ignoreInit = TRUE, ignoreNULL = TRUE
  )
  #if a user updates table1 table2 should also update.

  observeEvent(input$table2output,{
    df <- hot_to_r(input$table2output)
    df <- as.data.frame(df)
    table$table1 <- df
  }, ignoreInit = TRUE, ignoreNULL = TRUE
  )
  #if a user updates table2 table1 should also update.

}

shinyApp(ui = ui, server = server)
Rhsiny: Automatically update an output object based on updated rhandsontable object

Rhsiny: Automatically update an output object based on updated rhandsontable object


By : user2763600
Date : March 29 2020, 07:55 AM
seems to work fine Please read this. You can access the rhandsontable params via input$my_id. To get the current data use input$my_id$params$data.
Here is what I think you are after:
code :
library(shiny)
library(rhandsontable)

ui <- fluidPage(rHandsontableOutput("contents"),
                tableOutput("test_table"),
                tableOutput("test_table_subset"))

server <- function(input, output) {

  # dummy data
  x = c('A', 'A', 'A', 'B', 'B', 'C')
  y = c('G1', 'G1', 'G1', 'G2', 'G2', 'G3')
  z = c('100', '200', '300', '400', '500', '600')

  b = data.frame('Category' = x,
                 'Group' = y,
                 'Total' = z)

  # create reactive object to be used in multiple places
  test <- reactive({
    t <- b # dplyr::filter(b, b$Category %in% input$cat & b$Group %in% input$group)
    return(t)
  })

  output$contents <- renderRHandsontable({
    rhandsontable(test())
  })

  contentsTableDat <- reactive({
    req(input$contents)
    hot_to_r(input$contents)
  })

  output$test_table <- renderTable({
    contentsTableDat()
  })

  output$test_table_subset <- renderTable({
    contentsTableDat()[1, 3]
  })
}

shinyApp(ui = ui, server = server)
Modify rhandsontable by modifying another rhandsontable

Modify rhandsontable by modifying another rhandsontable


By : user3187568
Date : March 29 2020, 07:55 AM
it fixes the issue The main solution is that in DFR3 you should refer to input$hot instead of DFR2():
code :
DFR3 <- reactive({
  req(input$hot)
  hot_to_r(input$hot)
})
DFR4 <- reactive({
  req(DFR3())
  DF2[ which(DF2[,1] %in% DFR3()[1, 1]), ]
})
Related Posts Related Posts :
  • R 'cowplot' neatly produce gridded plot with shared (common) legends and unique legends
  • Repeat R script for many times and save results to text file
  • How to negative lookbehind for special characters
  • data.table inner join produces error when no match is found
  • Create a new column base on existing column, but row above
  • Is there a way to visualize the process of source() in RStudio?
  • google places api consumes 10 request but I am doing only 1
  • Statistical mode of a categorical variable in R (using mlv)
  • Using for-loop to mutate a data.frame in r
  • Make plot with regression line for mixed model
  • Shortcut to select matces cases in R studio
  • vectoriced norm/matrix multiplication
  • Negative log10 transformation in R
  • Plot data with duplicate points
  • Visualizing crosstab tables with a plot in R - changing colours
  • How to manually modify automated numbers and labels in plot
  • How can I follow any redirections of a url in R?
  • Add jitter to box plot using markers in plotly
  • Adding an extra item to the legend
  • ggplot fills in data in the wrong order
  • Convert list to data frame
  • R: filtering by list(s) of strings and returning all results that start with the content of the lists
  • R:How to attach parts of a data frame with different headers and/or an overflowing piece of the dat frame
  • How to use 'par' for manipulating plot margins?
  • Can dplyr::case_when return mix of NAs and non-NAs?
  • Text preprocessing and topic modelling using text2vec package
  • Uploading multiple files in Shiny, process the files, rbind the results and return a download
  • R levelplot: color green-white-red (white on 0) according to one variable, but show the values of another variable
  • Why [i] doesn't point to the starting point in a vector
  • In R after generating a mvrnorm distribution, Y, what does Y[,1] do?
  • expand a data frame to have as many rows as range of two columns in original row
  • Getting started with R and CFA
  • Re order x-axis in ggplot so time goes from 12AM to 11PM in R
  • R - Automatically stack every nth column of a data frame and save them as new objects
  • How to format dplyr output in R into doubles (or other workable format)?
  • Dataframe to matrix conversion using tapply turns zeros to NAs
  • Smallest multiple of 1:20 - How can I make it quicker?
  • How to specify the size of a graph in ggplot2 independent of axis labels
  • How can I find the number of a vector's elements in another vector?
  • ROC curve from train/test set in caret R package
  • Random Forest for a mixture of categorical,numeric and "unwanted" variables which include missing values
  • extract certain data from multiple excel files with R
  • Matrix with counts of wins and losses between methods in R
  • Grouping string variables from a dataframe by best string match to make subsets
  • Reorder does not work after adding second geom_points
  • cover POS data formate to the one can apply Arules (Apriori)
  • Matching values between data frames based on overlapping dates
  • Grouped bar chart turns into stacked bar chart ggplot
  • R: How to fill in NA Values within a Column based on grouping?
  • Two action buttons, but only the first one, that is written in the server file, works?
  • Barchart grouped by variable both count up to 100 percent
  • Converting time in R to 24 hours
  • R - Web scrapping and downloading multiple zip files and save the files without overwriting
  • Find month and year inside string
  • Append multiple csv files into one file using R
  • Use `purrr::map` with k-means
  • R - 'data' is not an exported object from 'namespace:my_package'
  • Sum vector with number by dinamic intervals without looping
  • Issues with ave function in R: error "cannot allocate vector of size 419 kb."
  • Shiny system call with continuous updates
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org