The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Simple reporter is a shiny
module for capturing app
views during the session, and eventually downloading a report document.
The Simple reporter module consists of two separate modules one for each
of the two buttons, Add Card and Download Report buttons modules.
module designed to capture and visualize application views throughout a session, facilitating the generation and download of a comprehensive report document. This module consists of two separate modules one for each of the two buttons.
The implementation should consist of 4 steps:
Reporter
instance.card
and comment
. This function must return a
ReportCard
object. The ReportCard
object
should be built step by step, assuming that it is empty at the
beginning.
comment
argument is provided, it should be added
to the card. If not, it should be added automatically at the end of the
card.card
argument is provided, the
ReportCard
instance should be automatically created for the
user. If not, the function should create the card itself. Please
note that the document page’s design is up to the developer’s
imagination.Reporter
instance and the
function to create the ReportCard
instance.The code added to introduce the reporter is wrapped in the
### REPORTER
code blocks.
First, load the required packages:
library(shiny)
library(teal.reporter)
library(ggplot2)
library(rtables)
Simple reporter shiny
app with separate modules for each
button:
<- fluidPage(
ui titlePanel(""),
sidebarLayout(
sidebarPanel(
uiOutput("encoding")
),mainPanel(
### REPORTER
$div(
tagsadd_card_button_ui("addReportCard"),
download_report_button_ui("downloadButton"),
reset_report_button_ui("resetButton")
),###
$br(),
tagstabsetPanel(
id = "tabs",
tabPanel("Plot", plotOutput("dist_plot")),
tabPanel("Table", verbatimTextOutput("table"))
)
)
)
)
<- function(input, output, session) {
server $encoding <- renderUI({
outputif (input$tabs == "Plot") {
sliderInput(
"binwidth",
"binwidth",
min = 2,
max = 10,
value = 8
)else {
} selectInput(
"stat",
label = "Statistic",
choices = c("mean", "median", "sd"),
"mean"
)
}
})
<- reactive({
plot req(input$binwidth)
<- mtcars$mpg
x ggplot(data = mtcars, aes(x = mpg)) +
geom_histogram(binwidth = input$binwidth)
})
$dist_plot <- renderPlot({
outputplot()
})
<- reactive({
table req(input$stat)
<- basic_table() %>%
lyt split_rows_by("Month", label_pos = "visible") %>%
analyze("Ozone", afun = eval(str2expression(input$stat)))
build_table(lyt, airquality)
})
$table <- renderPrint({
outputtable()
})
### REPORTER
<- Reporter$new()
reporter <- function(card = ReportCard$new(), comment) {
card_fun if (input$tabs == "Plot") {
$append_text("My plot", "header2")
card$append_plot(plot())
cardelse if (input$tabs == "Table") {
} $append_text("My Table", "header2")
card$append_table(table())
card
}if (!comment == "") {
$append_text("Comment", "header3")
card$append_text(comment)
card
}
card
}
add_card_button_srv("addReportCard", reporter = reporter, card_fun = card_fun)
download_report_button_srv("downloadButton", reporter = reporter)
reset_report_button_srv("resetButton", reporter)
###
}
if (interactive()) shinyApp(ui = ui, server = server)
Simple reporter shiny
app with combined buttons
modules:
<- fluidPage(
ui titlePanel(""),
sidebarLayout(
sidebarPanel(
uiOutput("encoding")
),mainPanel(
### REPORTER
simple_reporter_ui("simpleReporter"),
###
tabsetPanel(
id = "tabs",
tabPanel("Plot", plotOutput("dist_plot")),
tabPanel("Table", verbatimTextOutput("table"))
)
)
)
)
<- function(input, output, session) {
server $encoding <- renderUI({
outputif (input$tabs == "Plot") {
sliderInput(
"binwidth",
"binwidth",
min = 2,
max = 10,
value = 8
)else {
} selectInput(
"stat",
label = "Statistic",
choices = c("mean", "median", "sd"),
"mean"
)
}
})
<- reactive({
plot req(input$binwidth)
<- mtcars$mpg
x ggplot(data = mtcars, aes(x = mpg)) +
geom_histogram(binwidth = input$binwidth)
})
$dist_plot <- renderPlot({
outputplot()
})
<- reactive({
table req(input$stat)
<- basic_table() %>%
lyt split_rows_by("Month", label_pos = "visible") %>%
analyze("Ozone", afun = eval(str2expression(input$stat)))
build_table(lyt, airquality)
})
$table <- renderPrint({
outputtable()
})
### REPORTER
<- Reporter$new()
reporter <- function(card = ReportCard$new(), comment) {
card_fun if (input$tabs == "Plot") {
$append_text("My plot", "header2")
card$append_plot(plot())
cardelse if (input$tabs == "Table") {
} $append_text("My Table", "header2")
card$append_table(table())
card
}if (!comment == "") {
$append_text("Comment", "header3")
card$append_text(comment)
card
}
card
}
simple_reporter_srv("simpleReporter", reporter = reporter, card_fun = card_fun)
###
}
if (interactive()) shinyApp(ui = ui, server = server)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.