Shiny

Can I save the old value of a reactive object when it changes?

偶尔善良 提交于 2020-01-31 07:10:07
问题 Note: After coming up with the answer I reworded the question to make if clearer. Sometimes in a shiny app. I want to make use of a value selected by the user for a widget, as well as the previous value selected for that same widget. This could apply to reactive values derived from user input, where I want the old and the new value. The problem is that if I try to save the value of a widget, then the variable containing that value has to be reactive or it will not update every time the widget

RStudio Shiny renderDataTable font size

时光总嘲笑我的痴心妄想 提交于 2020-01-31 07:04:16
问题 I am trying to reduce the font size in my renderDataTable but I cannot find any example that controls font size. I have read that it is possible to control it through jquery but I cannot find any examples. Any guidance would be very helpful as I am using Shiny ioslides presentation and the font size in my data tables is simply too large. 回答1: You can put dataTableOutput("tableName") inside of div() and change the font using the style parameter. style takes CSS arguments. For example, if have

Shiny: download zip archive

試著忘記壹切 提交于 2020-01-31 03:32:26
问题 I can't make shiny's downloadHandler to output the zip file: # server.R library(shiny) shinyServer(function(input, output) { output$downloadData <- downloadHandler( filename <- function() { paste("output", "zip", sep=".") }, content <- function(fname) { fs <- c() tmpdir <- tempdir() setwd(tempdir()) for (i in c(1,2,3,4,5)) { path <- paste0("sample_", i, ".csv") fs <- c(fs, path) write(i*2, path) } zip(zipfile=fname, files=fs) } ) }) And the simple ui.R : shinyUI(fluidPage( titlePanel(""),

Shiny with multiple tabs and different sidebar in each tab

删除回忆录丶 提交于 2020-01-30 19:14:33
问题 I am trying to have multiple tabs, each tab with its own sidebar, I need selectInput in the first tab, and sliderInput in the second tab. Can anyone help ? My code: ui <- fluidPage( headerPanel("Terrorism in The World"), sidebarPanel( selectInput("Country", "Select Country", choices = sort(unique(mydat$Country)), selected = "Iraq") ,sliderInput("year", "Year:", min = 1968, max = 2009, value = 2009, sep='') ), mainPanel( tabsetPanel( tabPanel("Map",htmlOutput("Attacks")), tabPanel("plot",

Shiny datatable with child rows using ajax

自闭症网瘾萝莉.ら 提交于 2020-01-30 14:59:47
问题 I'm trying to use datatables library for shiny with more customization. Here is the example that I'm trying to make. https://datatables.net/examples/api/row_details.html Note that I have detail info in different data.frame R variables. like this A= data.frame(Name = c("Airi Satou", "Angelica Ramos","Paul Byrd") , Position = c("Accountant","Accountant", "CEO") , Office = c("Tokyo", "Tokyo", "New York")) A.detail= data.frame(Name = c("Airi Satou", "Angelica Ramos") , Extension= c("5407c", "8422

Shiny datatable with child rows using ajax

我与影子孤独终老i 提交于 2020-01-30 14:58:17
问题 I'm trying to use datatables library for shiny with more customization. Here is the example that I'm trying to make. https://datatables.net/examples/api/row_details.html Note that I have detail info in different data.frame R variables. like this A= data.frame(Name = c("Airi Satou", "Angelica Ramos","Paul Byrd") , Position = c("Accountant","Accountant", "CEO") , Office = c("Tokyo", "Tokyo", "New York")) A.detail= data.frame(Name = c("Airi Satou", "Angelica Ramos") , Extension= c("5407c", "8422

How do I wrap a blocking function into a promise RShiny

余生长醉 提交于 2020-01-30 09:41:27
问题 I have an R Shiny dashboard that has 2 observers that are set to refresh at specific times, One observer refreshes every 6 hours, the other every 2 mins. Both observers run a function that returns a reactive value. This works fine, however every 6 hours when the first observer is triggered it locks the dashboard and prevents the other observer from functioning. After some reading I know that I need to use futures and promises but am unable to implement anything that works as intended. How do

Working with a reactive() dataframe inside eventReactive()?

对着背影说爱祢 提交于 2020-01-30 08:41:08
问题 I was hoping someone could provide some guidance on resolving an issue I have. For background, I'm trying to create an interface for users to upload a csv of news stories, which they can then annotate as relevant or not relevant for the purposes of a classifier. What should appear once the user has uploaded a csv is a table output with selectable rows. The text associated with the selected row would then display in the lower right. The setup I have attempted is to put the user-uploaded

Shiny app is only half of browser window

帅比萌擦擦* 提交于 2020-01-30 06:49:05
问题 I've recently started learning Shiny and am developing my first practice app. For some reason, my app doesn't take up the entire browser window but is cutoff about half way. The page can still scroll down to see the rest of the output but there is a high fold for some reason. Below is my code: library(foreign) library(dplyr) library(shiny) library(dplyr) library(ggplot2) library(shinythemes) thesis <- read.csv("thesis.csv", stringsAsFactors = T) ui <- fluidPage(theme = shinytheme("cerulean"),

How to use query parameters in Shiny

末鹿安然 提交于 2020-01-30 05:53:38
问题 I have two user groups in a DB. I want to query the DB to show a checkboxGroup in a Shiny app, with only one of the groups, depending on a URL query parameter. For example, with a URL query parameters like this: http://127.0.0.1:4014/?groupId=1 ideally, I would like to get that groupId value and use it to filter the user group: res <- dbSendQuery(con, paste('SELECT user_id, user_name FROM info i , enrolment e WHERE i.user_id = e.fk_user_id AND e.fk_group_id = ', groupId)) dataf <- dbFetch(res