Extract data from a Domain object.

# S4 method for Domain
[(x, i, j)

# S4 method for Domain
$(x, name)

# S4 method for Domain
$(x, name) <- value

Arguments

x

(Domain).

i, j

(numeric or character)
indices of the columns/rows to select.

name

(character)
name of the object in x to access.

value

(atomic or domain).

Functions

  • [,Domain-method: select with brackets and indices.

  • $,Domain-method: select a variable with the dollar symbol $.

  • $<-,Domain-method: assign a variable with the dollar symbol $.

Examples

dta <- DM( dm[1:3, c("STUDYID", "SUBJID", "RACE")], data.frame(row.names = "STUDYID", label = "Study Identifier") ) dta
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID RACE #> 1 S-CDSK-01 100008 OTHER #> 2 S-CDSK-01 100014 WHITE #> 3 S-CDSK-01 200001 MULTIPLE #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #> RACE <NA> #>
dta[1, ]
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID RACE #> 1 S-CDSK-01 100008 OTHER #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #> RACE <NA> #>
dta[, 1]
#> An object of class "DM" #> Slot "df": #> STUDYID #> 1 S-CDSK-01 #> 2 S-CDSK-01 #> 3 S-CDSK-01 #> #> Slot "columns": #> label #> STUDYID Study Identifier #>
dta[1, 1]
#> An object of class "DM" #> Slot "df": #> STUDYID #> 1 S-CDSK-01 #> #> Slot "columns": #> label #> STUDYID Study Identifier #>
dta[1:2, ]
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID RACE #> 1 S-CDSK-01 100008 OTHER #> 2 S-CDSK-01 100014 WHITE #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #> RACE <NA> #>
dta[, 1:2]
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID #> 1 S-CDSK-01 100008 #> 2 S-CDSK-01 100014 #> 3 S-CDSK-01 200001 #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #>
dta[1:2, 1:2]
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID #> 1 S-CDSK-01 100008 #> 2 S-CDSK-01 100014 #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #>
dta <- DM( dm[1:2, c("STUDYID", "SUBJID", "RACE", "AGE")], data.frame(row.names = "STUDYID", label = "Study Identifier") ) dta
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID RACE AGE #> 1 S-CDSK-01 100008 OTHER 72 #> 2 S-CDSK-01 100014 WHITE 66 #> #> Slot "columns": #> label #> STUDYID Study Identifier #> SUBJID <NA> #> RACE <NA> #> AGE <NA> #>
dta$RACE
#> An object of class "DM" #> Slot "df": #> RACE #> 1 OTHER #> 2 WHITE #> #> Slot "columns": #> label #> RACE <NA> #>
dta$STUDYID
#> An object of class "DM" #> Slot "df": #> STUDYID #> 1 S-CDSK-01 #> 2 S-CDSK-01 #> #> Slot "columns": #> label #> STUDYID Study Identifier #>
dta_1 <- DM( dm[1:3, c("STUDYID", "SUBJID", "ARMCD")], data.frame( row.names = "STUDYID", label = "Study Identifier", comment = "std" ) ) dta_1$new_var <- 1:3 dta_1
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID ARMCD new_var #> 1 S-CDSK-01 100008 WONDER10 1 #> 2 S-CDSK-01 100014 WONDER20 2 #> 3 S-CDSK-01 200001 PLACEBO 3 #> #> Slot "columns": #> label comment #> STUDYID Study Identifier std #> SUBJID <NA> <NA> #> ARMCD <NA> <NA> #> new_var <NA> <NA> #>
dta_2 <- DM( dm[1:3, c("STUDYID", "SUBJID", "AGE")], data.frame( row.names = c("STUDYID", "AGE"), names = c("Study Identifier", "Age"), label = c(NA, "Age") ) ) dta_2$AGE
#> An object of class "DM" #> Slot "df": #> AGE #> 1 72 #> 2 66 #> 3 80 #> #> Slot "columns": #> names label #> AGE Age Age #>
dta_1$age <- dta_2$AGE dta_1
#> An object of class "DM" #> Slot "df": #> STUDYID SUBJID ARMCD new_var age #> 1 S-CDSK-01 100008 WONDER10 1 72 #> 2 S-CDSK-01 100014 WONDER20 2 66 #> 3 S-CDSK-01 200001 PLACEBO 3 80 #> #> Slot "columns": #> label comment names #> STUDYID Study Identifier std <NA> #> SUBJID <NA> <NA> <NA> #> ARMCD <NA> <NA> <NA> #> new_var <NA> <NA> <NA> #> AGE Age <NA> Age #>