rhandsontable

Retrieving values from an rhandsontable object (R, R shiny)

冷暖自知 提交于 2020-01-02 08:24:10
问题 I use the (awesome) package rhandsontable that will later be included in an R shiny webpage. The user can click at some places, and I want to know how to retrieve the info on which rows was clicked. Here is an example, (to be copy&paste in an R terminal): library(rhandsontable) ## Create the dataset min = c(1,seq(2,34,by=2)) kmh = c(0,seq(7,23,by=1)) mph = round( kmh / 1.609344, digits=0 ) stop.speed = rep(FALSE, length(min)) DF = data.frame(min, kmh, mph, stop.speed, stringsAsFactors = FALSE

Search from a textInput to a Handsontable in Shiny

删除回忆录丶 提交于 2019-12-24 11:07:08
问题 I've been working for some days with Handsontable in Shiny and I got stuck in what I guess will be a very dumb question but I have not this much idea how to solve. I have a Handsontable that has a custom function that allows searching and it works. It works but is not intuitive enough because you have to right-click on the table to pop the search option. Because of this, I decided that I would like to have a textInput that does the same function but in a prettier way. I know that it should be

Synchronize horizontal scrolling of two handsontables

微笑、不失礼 提交于 2019-12-24 07:59:07
问题 I'd like to synchronize the scrolling of two handsontables in a shiny app. I tried some attempts based on proposals given here and here. I also tried with the jquery.scrollSync library, my code is below. Nothing works. library(shiny) library(rhandsontable) ui = shinyUI(fluidPage( tags$head(tags$script(src = "http://trunk.xtf.dk/Project/ScrollSync/jquery.scrollSync.js")), sidebarLayout( sidebarPanel(), mainPanel( rHandsontableOutput("hot", width = 350), rHandsontableOutput("hot2", width = 350)

Passing parameter to custom renderer in rhandsontable does not work inside a Shiny App

北城以北 提交于 2019-12-23 19:03:26
问题 I need to pass some parameters into a custom rhandsontable renderer. It works fine when executed inside RStudio, but does not render anything when used inside a Shiny App. Here is the code for the custom renderer that sets bold font: renderSheet <- function(df, bold) { rhandsontable( df, col_bold = bold$col, row_bold = bold$row) %>% hot_cols(renderer = " function(instance, td, row, col, prop, value, cellProperties) { Handsontable.renderers.TextRenderer.apply(this, arguments); tbl = this

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

心已入冬 提交于 2019-12-23 05:47:16
问题 Not a Shiny programmer. Simple question. rhandsontable in Flexdashboard app. How to access a column updated by the user? Sample code: --- title: "Test" runtime: shiny output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill --- ```{r setup, include=FALSE} library(flexdashboard) library(shiny) require(dplyr) require(tidyverse) require(rhandsontable) hour <- 1:24 required <- c(2, 2, 2, 2, 2, 2, 8, 8, 8, 8, 4, 4, 3, 3, 3, 3, 6, 6, 5, 5, 5, 5, 3, 3) required <- as.integer

How to make column heading letters bold in rhandsontable in shiny

给你一囗甜甜゛ 提交于 2019-12-21 06:36:20
问题 How to make column heading bold text in rhandsontable in shiny package of r? I have a rhandsontable in shiny that I want to make bold the text in the header. How can I do it? Does anyone know? 回答1: You can add some style to your table as so: library(shiny) library(rhandsontable) ui <- fluidPage( rHandsontableOutput("table1"), tags$style(type="text/css", "#table1 th {font-weight:bold;}") ) server=function(input, output, session) { output$table1 <- renderRHandsontable({ rhandsontable(mtcars

show the sum of specific columns based on rhandsontable values

删除回忆录丶 提交于 2019-12-11 15:58:38
问题 I am trying to create a shiny app, that would show a sum of a column (say mtcars$mpg) when rows are selected by the users. e.g if the first two boxes are clicked in rhandsontable, then below i should see a sum of 21 and 21. I am unable to wrap my head around it, and have made this code so far: library(shiny) library(rhandsontable) ui=fluidPage( rHandsontableOutput('table'), textOutput ('selected') ) server=function(input,output,session)({ df <- data.frame(head(transform(mtcars, Selected = as

Color a whole row in rhandsontable based on a string value in one column

橙三吉。 提交于 2019-12-11 05:34:40
问题 I have an rhandsontable and I want the WHOLE ROW to be yellow if the cell in the text in the last column ("Comments") includes string "missed". The code below highlights any cell that has a value 'missed', but not the whole row. Besides, I'd like the row to turn yellow when a cell in the last column CONTAINS "missed" - even inside a longer string, and not just when it contains only "missed" - as it is written now - I just don't know how to match strings in JavaScript. DF = data.frame(a = 1:2,

r shiny: updating rhandsontable from another rhandsontable

纵饮孤独 提交于 2019-12-11 00:58:24
问题 I hope you're well. I am trying to create a shiny dashboard whereby a user is able to update one rhandsontable from another. My code is as follows: 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.POSIXct((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

Reactive/Calculate Columns in rhandsontable in shiny- rstudio

狂风中的少年 提交于 2019-12-10 12:24:42
问题 I am trying to add a custom validation to the following interactive table. What I am trying to do is as follows. The table contains three variables namely mpg,cyl and disp. Suppose I edit the mpg value of the first row. Then once I press the enter button, disp value of the 1st row should be automatically changed calculated as disp=mpg/cyl. Here mpg value being the new value I edited. Likewise if I edit cyl in a particular row again disp of that particular row should be changed automatically