rm(list = ls()) library(datasets) library(data.table) library(ggplot2) runWithoutInstall <- T ifelse(runWithoutInstall, sapply(list.files(path = "../R/", pattern="*R", full.names = T), source), library(shinypipe)) n <- 42 r.data <- reactive( data.table(int = as.integer(runif(n) * 100 + 1), dbl = runif(n), date = Sys.Date() + 1:n, time = Sys.time() + (1:n)^2 * 60))
renderUI({ cols <- names(r.data()) colsY <- list(choices = cols) colsX <- list(choices = c(cols[-1], cols[1])) ui.formula("form", colsY, colsX, simpleFormula = T, theme = "small") }) r.form <- callModule(s.formula, "form")
r.yVal <- callModule(s.formula.y, "form") r.xVal <- callModule(s.formula.x, "form") r.plot <- reactive(geom_point(aes_string(x=r.xVal(), y=r.yVal()))) ui.plot("plot.modify") r.brushedData.modify <- callModule(s.plot, "plot.modify", r.plot.modify, r.data)
renderDataTable({ tt <- r.brushedData.modify() if (nrow(tt) == 0) return (r.data()) tt })
r.plot.modify <- reactive(list( r.plot(), theme_classic(base_size = 20))) ui.plot("plot", zoom=NULL, brush=list(direction="x")) r.brushedData <- callModule(s.plot, "plot", r.plot, r.data)
ui.plot("plot.sec", zoom=T) r.brushedData.sec <- callModule(s.plot, "plot.sec", r.plot, r.brushedData)
ui.flexOutput("flex-non-edit") invisible(callModule(s.flexOutput, "flex-non-edit", environment(), "ls()", editable=F)) ui.flexOutput("flex") invisible(callModule(s.flexOutput, "flex", environment(), "r.data()", "Table", rows=5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.