Subpopulation: Population Module

Description Format Input Output Super class Methods See Also Examples

Description

The filter module provides an interface to select a data set, variable, and a query based on the value.

Format

R6 class

Input

datalist

A list of data sets. Can be tibbles, data frames, etc. Expects them to have a common ID field (default is USUBJID)

options

The options for the module of type reactiveValues with values

populationNumber

The index of the population that we are creating. If given, will include as the default name for the population "New population: populationNumber"

hideOnSave

Boolean. Should the population card be hidden when we save? Default: TRUE

idvar

ID field that is common across all datasets in datalist. Default USUBJID

Output

savePopulation

S3 object PopulationFilter returned when Save Population button is pressed

editPopulation

S3 object PopulationFilter which is updated after any change to the population.

Super class

tidymodules::TidyModule -> Subpopulation

Methods

Public methods

Inherited methods

Method new()

Usage
Subpopulation$new(...)

Method ui()

Usage
Subpopulation$ui()

Method server()

Usage
Subpopulation$server(input, output, session, data = NULL, options = NULL)

Method clone()

The objects of this class are cloneable with this method.

Usage
Subpopulation$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other tidymodules: Filter, SubgroupManager, Subgroup, SubpopulationManager, TTEMapping, TTE, TableListing, VariableSelection

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
## Not run: 
library(tidymodules)
library(subpat)
library(bs4Dash)

# Create a new population edit module

ui <- tagList(
  shinyjs::useShinyjs(),
  bs4DashPage(
    sidebar = bs4DashSidebar(disable = TRUE),
    body = bs4DashBody(
      popedit$ui(),
      
      fluidRow(
        column(width = 6, 
               p("Editing population"),
               verbatimTextOutput('editing_population')),
        column(width = 6,
               p("Saved object"),
               verbatimTextOutput('saved_population'))
      )
    )
  )
)

# Define server logic required to draw a histogram
server <- function(input, output) {
  datalist <- reactive({
    list(
      "ADSL" = data.frame(
        a = c("x", "z", "y", "x", "z", "x", "x", "y", "x", "y"),
        b = c(29L, 4L, 15L, 28L, 41L, 25L, 41L, 15L, 6L, 17L),
        USUBJID = as.character(seq_len(10)),
        stringsAsFactors = FALSE
      ),
      "ADAE" = data.frame(
        a = c("x", "z", "y", "x", "z", "x", "x", "y", "x", "y"),
        c = c(1, NA, NA, 1, 2, NA, NA, 4, 3, 1),
        dates = seq(as.Date("2019-07-10"), as.Date("2019-08-12"), length.out = 10),
        USUBJID = as.character(seq_len(10)),
        stringsAsFactors = FALSE
      )
    )
  })
  
  popedit$callModule()
  
  opts <- reactiveValues(
    hideOnSave = FALSE,
    populationNumber = 1,
    subjectDs = "ADSL",
    idvar = "USUBJID"
  )
  
  observe({
    # Add the data to the module
    datalist %>1% popedit
    
    # Add the options to the population editing module
    opts %>2% popedit
  })
  
  output$saved_population <- renderPrint({
    req(popedit)
    str(popedit$getOutput(1)())
  })
  
  output$editing_population <- renderPrint({
    req(popedit)
    str(popedit$getOutput(2)())
  })
}

# Run the application 
shinyApp(ui = ui, server = server)

## End(Not run)

Novartis/subpat documentation built on April 11, 2020, 3:11 p.m.