天道酬勤,学无止境

reactive

Shiny assign reactive variable from input using loop

Question I'm trying to assign reactive variable based on my input using loop. For example, I want to select the column (from input) in iris data set. Then get the unique value from that column. And I want to do this in the loop. I find it works for my 'joke' variable, but not for my 'Group[[paste0('Gcol',i)]]' variable. I've been searching answer for this for days. Thank you for your help in advance! library(shiny) data=iris ui <- fluidPage( titlePanel("Old Faithful Geyser Data"), sidebarLayout( sidebarPanel( fluidRow( column(9,wellPanel(lapply(1:5, function(i) { selectizeInput(paste0(

2022-05-17 03:50:21    分类:技术分享    loops   shiny   reactive

Interactive file input and reactive reading in shinyapp

Question I would like to make a shinyapp that integrates the functionality of choosing a file (in a selected folder), (like in Interactive directory input in Shiny app (R)), and then reading it reactively by detecting changes in it, as in https://gist.github.com/wch/9652222. However, I could not make the reactiveFileReader function work with a reactive filename (folder). It seems to work only with one pre-determined filename. In this app, the file is expected to be chosen automatically after chosing any folder (button), provided that it is inside and has the same name of the subfolder and the

2022-05-16 20:11:37    分类:技术分享    r   shiny   reactive

accessing reactiveValues in a reactiveValuesToList

Question Instead of specifying separate fileInput variables, I'd like to use reactiveValues to store uploaded CSV dataframes, manipulate them in some way, and then store them for accession later. My design is to name each dataframe by its filename and append to the reactiveValue rvTL. My questions are, How can I access individual dataframes under the list I created using reactiveValuesToList(rvTL)? Next step, how to create a selectInput menu to access the individual dataframes uploaded by fileInput To learn this concept, I am piggybacking off the answer from Dean Attali and made rvTL the same

2022-05-16 14:27:08    分类:技术分享    r   shiny   reactive

R Shiny - How to create a barplot that reacts according to the time unit (Week, Month, Year) and aggregates data by time unit

Question I generate a dataframe about a disease with the following variables: Date (date of disease) Cases (number of cases, by default, the number of cases is 1) Week (week of disease case) Month (month of disease case) Year (year of disease case). My ui is here: library(shiny) library(dplyr) library(lubridate) library(ggplot2) library(scales) Disease<-data.frame(Date=seq(as.Date("2015/1/1"), as.Date("2017/1/1"), "days"),Cases=rep(1)) Disease$Week<-as.Date(cut(Disease$Date,breaks="week",start.on.monday = TRUE)) Disease$Month<-as.Date(cut(Disease$Date,breaks="month")) Disease$Year<-as.Date(cut

2022-05-02 20:16:38    分类:技术分享    r   date   shiny   dplyr   reactive

Migrate from RACSignal to ReactiveSwift or RAC5

Question I'm new with Swift, and that's why I'm new with Reactive Cocoa v5 or Reactive Swift. Previously I used RACSignal with RAC 2.x and I liked to do something like this: - (RACSignal *)signalForGET:(NSString *)URLString parameters:(NSDictionary *)parameters { return [RACSignal createSignal:^RACDisposable *(id <RACSubscriber> subscriber) { AFHTTPRequestOperation *op = [self GET:URLString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { [subscriber sendNext:responseObject]; [subscriber sendCompleted]; } failure:^(AFHTTPRequestOperation *operation

2022-05-01 15:13:24    分类:技术分享    swift   reactive-cocoa   reactive   racsignal   reactive-swift

An equivalent to computed properties using @Published in Swift Combine?

Question In imperative Swift, it is common to use computed properties to provide convenient access to data without duplicating state. Let's say I have this class made for imperative MVC use: class ImperativeUserManager { private(set) var currentUser: User? { didSet { if oldValue != currentUser { NotificationCenter.default.post(name: NSNotification.Name("userStateDidChange"), object: nil) // Observers that receive this notification might then check either currentUser or userIsLoggedIn for the latest state } } } var userIsLoggedIn: Bool { currentUser != nil } // ... } If I want to create a

2022-03-29 05:18:27    分类:技术分享    ios   swift   swiftui   reactive   combine

Shiny app: nothing changes when clicking on action button

Question Building on multiple stackoverflow questions, I tried to build this app which contains two action buttons the first one shows a data table the second one should open another sourced app but actually, nothing changes but in the global environment all list, functions, and dataframes are reflecting. the used code. #UI.R library(shiny) library(shinydashboardPlus) library(DT) library(readxl) library(dplyr) library(formattable) library(shinydashboard) library(shinyjqui) library(shinyjs) library(shinythemes) library(markdown) title <- "emblem" ui = fluidPage(theme=shinytheme("superhero")

2022-03-08 05:32:46    分类:技术分享    r   shiny   shinydashboard   reactive

Change Leaflet Map Dynamically based on Multiple Reactive expressions

Question In the example Data Frame DF, I have the following columns. gender <- c("Male", "Female","Female", "Male") Location <- c("AB", "BC", "CD", "DE") hasTV <- c("Yes","Yes","No","No") Latitude <- c(49.82380908513249,59.478568831926395,59.478568831926395,49.82380908513249) Longitude <- c(-10.8544921875,-10.8544921875,2.021484375,2.021484375) DF <- data.frame(gender,Location,hasTV,Latitude,Longitude) Under UI, i've used radiobuttons to select options from hasTV, checkboxGroupInput to select Gender and selectInput to create a dropdown of Location. I've implemented this in fluidRow as shown

2022-02-13 17:02:12    分类:技术分享    r   shiny   shinydashboard   reactive   r-leaflet

How to edit the newly added item from a row using angular8

Question i am using reactive forms, if i edit the values which is already present in database it gets edited and gets saved in that particular row, as it has unique id as agentw9id, but if i create new item and edit that, it gets added with the new id, so i tried with this method, here, for index 0, it doesnt work but for other values it used to get update, but it used to go all values at time of final save instead of sending the edited change of the newly added items. DEMO: DEMO TS: saveW9Details(item) { this.addButtonDisable = false; if(this.employee ) { if(item.agentW9id.value) { for(var i

2022-02-12 12:49:21    分类:技术分享    angular   reactive

object of type ‘closure’ is not subsettable in R Shiny

Question I would like to add buttons to my DT (one for each row - in first column). When I click on the button it should remove the row from DT. I wrote a code: library(shiny) library(DT) shinyApp( ui <- fluidPage(DT::dataTableOutput("data")), server <- function(input, output) { values <- reactiveValues(data = NULL) values$data <- as.data.frame( cbind(c("a", "d", "b", "c", "e", "f"), c(1463, 159, 54, 52, 52, 220), c(0.7315, 0.0795, 0.027, 0.026, 0.026, 0.11) ) ) shinyInput <- function(FUN, len, id, ...) { inputs <- character(len) for (i in seq_len(len)) { inputs[i] <- as.character(FUN(paste0

2022-02-10 00:20:49    分类:技术分享    r   button   shiny   dt   reactive