This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lookup_list_vs_env.R | |
# comparing the performance of lookups with lists as opposed to | |
# environments in R. As the size of the collection increases, the better | |
# performance of the environments for lookups is multiples better. | |
library(microbenchmark) | |
library(purrr) | |
library(stringr) | |
e1 <- new.env() | |
l1 <- list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is a Shiny web application. You can run the application by clicking | |
# the 'Run App' button above. | |
# | |
# Find out more about building applications with Shiny here: | |
# | |
# http://shiny.rstudio.com/ | |
# | |
library(shiny) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# oberveEvent includes the ability of the first parameter to be an expression. But if the return value of that expression is | |
# null, the ignore null setting blocks updates, even though other parts of the expression are updating. | |
# in the example below with the default settings, button Event1 will only trigger the update of "observeEvent either button" | |
# after Event2 has been pushed at least once | |
library(shiny) | |
# Define UI for application that draws a histogram | |
ui <- fluidPage( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(DT) | |
library(dplyr) | |
library(future) | |
library(magrittr) | |
plan(multiprocess) | |
dedupe <- function(r) { | |
makeReactiveBinding("val") | |
observe(val <<- r(), priority = 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# notice the flush on the single user holds up the user updating, as the promise and reactive variable is there per user | |
library(shiny) | |
library(DT) | |
library(dplyr) | |
library(future) | |
library(promises) | |
plan(multiprocess) | |
ui <- fluidPage( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(DT) | |
library(dplyr) | |
library(future) | |
library(promises) | |
plan(multiprocess) | |
ui <- fluidPage( | |
verbatimTextOutput("timer"), | |
DTOutput("myTable") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
library(shiny) | |
# Define UI for application that draws a histogram | |
ui <- fluidPage( | |
# Application title | |
titlePanel("Reactive values updating"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is a Shiny web application. | |
# with a handler that returns plain json | |
# run and in a browser look for /health/ | |
# e.g. http://127.0.0.1:5732/health/ | |
# from https://stackoverflow.com/users/1455889/amaurel | |
# on https://stackoverflow.com/questions/19991654/shiny-server-print-json-as-a-result-output | |
# You can run the application by clicking | |
# the 'Run App' button above. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This was an attempt to return json on /health/ with shiny.router | |
# https://appsilon.com/shiny-router-package/ | |
# trying https://stackoverflow.com/users/7268834/slavakx 's suggestion | |
# https://stackoverflow.com/questions/19991654/shiny-server-print-json-as-a-result-output | |
# but the json is already wrapped | |
library(shiny) | |
library(shiny.router) | |
library(data.table) | |
library(jsonlite) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# samples of some joins of data.tables with trivial tables | |
library(data.table) | |
dt1 <- data.table(f1=1:5, f2=sample(letters,5)) | |
dt2 <- data.table(f1=2:6, f3=sample(letters,5)) | |
dt3 <- data.table(f1=c(2,2:6), f3=sample(letters,6)) | |
dt1 | |
dt2 | |
dt3 |
OlderNewer