rendering-step-attrition {shinyCohortBuilder} | R Documentation |
Generate output of attrition plot
Description
The method should return list of two object:
render Rendering expression of attrition output.
output Output expression related to rendering (with id equal to 'id' parameter).
For example:
list( render = shiny::renderPlot({ cohort$show_attrition() }), output = shiny::plotOutput(id) )
Usage
.step_attrition(source, ...)
## Default S3 method:
.step_attrition(source, id, cohort, session, ...)
## S3 method for class 'tblist'
.step_attrition(source, id, cohort, session, ...)
Arguments
source |
Source object. |
... |
Extra arguments passed to specific method. |
id |
Id of attrition output. |
cohort |
Cohort object. |
session |
Shiny session object. |
Value
List of two objects: 'render' and 'output' defining rendering and output placeholder for step attrition plot feature.
See Also
Examples
if (interactive()) {
library(magrittr)
library(shiny)
library(cohortBuilder)
library(shinyCohortBuilder)
coh <- cohort(
set_source(as.tblist(librarian)),
step(
filter(
"range", id = "copies", dataset = "books",
variable = "copies", range = c(5, 12)
)
),
step(
filter(
"range", id = "copies", dataset = "books",
variable = "copies", range = c(6, 8)
)
)
) %>% run()
ui <- fluidPage(
div(id = "attrition")
)
server <- function(input, output, session) {
rendering <- .step_attrition(
coh$get_source(), id = "attr", cohort = coh, session = session, dataset = "books"
)
insertUI("#attrition", ui = rendering$output)
output$attr <- rendering$render
}
shinyApp(ui, server)
}
[Package shinyCohortBuilder version 0.2.1 Index]