-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
227 additions
and
25 deletions.
There are no files selected for viewing
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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
dropNulls <- function(x) { | ||
x[!vapply(x, is.null, FUN.VALUE = logical(1))] | ||
} |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
library(shiny) | ||
library(capture) | ||
|
||
ui <- fluidPage( | ||
tags$h2("Capture PDF (loading) example"), | ||
capture_pdf( | ||
selector = "body", | ||
filename = "all-page", | ||
icon("camera"), "Take screenshot of all page", | ||
scale = 2, | ||
statusInputId = "loading" | ||
), | ||
tags$br(), | ||
fluidRow( | ||
column( | ||
width = 4, | ||
wellPanel( | ||
tags$b("Parameters :"), | ||
selectInput( | ||
inputId = "loi", | ||
label = "Law:", | ||
choices = c("normal", "uniform", "exponential") | ||
) | ||
) | ||
), | ||
column( | ||
width = 8, | ||
tags$div( | ||
id = "result-block", | ||
tags$b("Results :"), | ||
plotOutput(outputId = "plot"), | ||
uiOutput(outputId = "mean"), | ||
verbatimTextOutput(outputId = "raw") | ||
) | ||
) | ||
) | ||
) | ||
|
||
server <- function(input, output, session) { | ||
distrib_r <- reactive({ | ||
switch( | ||
input$loi, | ||
"normal" = rnorm(1000), | ||
"uniform" = runif(1000), | ||
"exponential" = rexp(1000) | ||
) | ||
}) | ||
|
||
output$plot <- renderPlot({ | ||
hist(distrib_r()) | ||
}) | ||
|
||
output$mean <- renderUI({ | ||
tags$p(tags$b("The mean is :"), round(mean(distrib_r()), 2)) | ||
}) | ||
|
||
output$raw <- renderPrint({ | ||
summary(distrib_r()) | ||
}) | ||
|
||
observeEvent(input$loading, { | ||
if (identical(input$loading$status, "started")) { | ||
showNotification(ui = "Capturing screenshot, please wait...") | ||
} | ||
if (identical(input$loading$status, "finished")) { | ||
showNotification(ui = "Screenshot captured!", type = "message") | ||
} | ||
}) | ||
} | ||
|
||
if (interactive()) | ||
shinyApp(ui, server) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
library(shiny) | ||
library(capture) | ||
|
||
ui <- fluidPage( | ||
tags$h2("Capture (loading) example"), | ||
capture( | ||
selector = "body", | ||
filename = "all-page", | ||
icon("camera"), "Auto loading indicator", | ||
loading = loading(text = "Capturing screenshot...") | ||
), | ||
capture( | ||
selector = "body", | ||
filename = "all-page", | ||
icon("camera"), "Input value", | ||
statusInputId = "loading" | ||
), | ||
tags$br(), | ||
fluidRow( | ||
column( | ||
width = 4, | ||
wellPanel( | ||
tags$b("Parameters :"), | ||
selectInput( | ||
inputId = "loi", | ||
label = "Law:", | ||
choices = c("normal", "uniform", "exponential") | ||
) | ||
) | ||
), | ||
column( | ||
width = 8, | ||
tags$div( | ||
id = "result-block", | ||
tags$b("Results :"), | ||
plotOutput(outputId = "plot"), | ||
uiOutput(outputId = "mean"), | ||
verbatimTextOutput(outputId = "raw") | ||
) | ||
) | ||
) | ||
) | ||
|
||
server <- function(input, output, session) { | ||
|
||
distrib_r <- reactive({ | ||
switch( | ||
input$loi, | ||
"normal" = rnorm(1000), | ||
"uniform" = runif(1000), | ||
"exponential" = rexp(1000) | ||
) | ||
}) | ||
|
||
output$plot <- renderPlot({ | ||
hist(distrib_r()) | ||
}) | ||
|
||
output$mean <- renderUI({ | ||
tags$p(tags$b("The mean is :"), round(mean(distrib_r()), 2)) | ||
}) | ||
|
||
output$raw <- renderPrint({ | ||
summary(distrib_r()) | ||
}) | ||
|
||
observeEvent(input$loading, { | ||
if (identical(input$loading$status, "started")) { | ||
showNotification(ui = "Capturing screenshot, please wait...") | ||
} | ||
if (identical(input$loading$status, "finished")) { | ||
showNotification(ui = "Screenshot captured!", type = "message") | ||
} | ||
}) | ||
|
||
} | ||
|
||
if (interactive()) | ||
shinyApp(ui, server) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.