Skip to content

Commit 78912d8

Browse files
committed
Added PF, AU, PE, PC domains
1 parent f6f20aa commit 78912d8

2 files changed

Lines changed: 39 additions & 21 deletions

File tree

R/table_variables.R

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#' Tabulate function to display variables in a given domain
22
#'
3-
#' Uses table() to display the variables contained within an SDTM
4-
#' formatted data frame. Additionally can be split by STUDYID to display the
5-
#' options across multiple studies.
3+
#' Uses table() to display the variables contained within an SDTM formatted data
4+
#' frame. Additionally can be split by STUDYID to display the options across
5+
#' multiple studies.
66
#'
7-
#' @param domain Character. The two letter code for the domain which matches the data.
8-
#' Character string. Domains included: "DM", "LB", "RP", "MB", "MP", "SA",
9-
#' "IN", "VS", "DS", "RS", "PO", "SC", "HO", "ER" & "DD".
7+
#' @param domain Character. The two letter code for the domain which matches the
8+
#' data.
9+
#' Domains included: "DM", "LB", "RP", "MB", "MP", "SA", "IN", "VS",
10+
#' "DS", "RS", "PO", "SC", "HO", "ER", "DD", "PF", "AU", "PC", "PE".
1011
#' @param data Domain data frame.
1112
#' @param by_STUDYID Boolean. Split data by STUDYID if TRUE. Default is FALSE.
1213
#'
@@ -36,25 +37,33 @@ table_variables <- function(domain, data, by_STUDYID = FALSE) {
3637
} else if (domain == "MP") {
3738
return(table(data$MPLOC, useNA = "ifany"))
3839
} else if (domain == "SA") {
39-
return(table(str_to_upper(data$SATERM), useNA = "ifany")) ###
40+
return(table(str_to_upper(data$SATERM), useNA = "ifany"))
4041
} else if (domain == "IN") {
41-
return(table(str_to_upper(data$INTRT), useNA = "ifany")) ###
42+
return(table(str_to_upper(data$INTRT), useNA = "ifany"))
4243
} else if (domain == "VS") {
4344
return(table(data$VSTESTCD, useNA = "ifany"))
4445
} else if (domain == "DS") {
45-
return(table(data$DSDECOD, useNA = "ifany")) ###
46+
return(table(data$DSDECOD, useNA = "ifany"))
4647
} else if (domain == "RS") {
4748
return(table(data$RSTESTCD, useNA = "ifany"))
4849
} else if (domain == "PO") {
49-
return(table(str_to_upper(data$POTERM), useNA = "ifany")) ###
50+
return(table(str_to_upper(data$POTERM), useNA = "ifany"))
5051
} else if (domain == "SC") {
5152
return(table(data$SCTESTCD, useNA = "ifany"))
5253
} else if (domain == "HO") {
53-
return(table(data$HOTERM, useNA = "ifany")) ###
54+
return(table(data$HOTERM, useNA = "ifany"))
5455
} else if (domain == "ER") {
55-
return(table(data$ERTERM, useNA = "ifany")) ###
56+
return(table(data$ERTERM, useNA = "ifany"))
5657
} else if (domain == "DD") {
57-
return(table(data$DDTEST, useNA = "ifany"))
58+
return(table(data$DDTESTCD, useNA = "ifany"))
59+
} else if (domain == "PF") {
60+
return(table(data$PFTESTCD, useNA = "ifany"))
61+
} else if (domain == "AU") {
62+
return(table(data$AUTESTCD, useNA = "ifany"))
63+
} else if (domain == "PC") {
64+
return(table(data$PCTESTCD, useNA = "ifany"))
65+
} else if (domain == "PE") {
66+
return(table(data$PETESTCD, useNA = "ifany"))
5867
} else{
5968
warn(str_c(domain, " domain not included in table_variables() function."))
6069
}
@@ -86,11 +95,19 @@ table_variables <- function(domain, data, by_STUDYID = FALSE) {
8695
} else if (domain == "SC") {
8796
return(table(data$STUDYID, data$SCTESTCD, useNA = "ifany"))
8897
} else if (domain == "HO") {
89-
return(table(data$STUDYID, data$HOTERM, useNA = "ifany")) ###
98+
return(table(data$STUDYID, data$HOTERM, useNA = "ifany"))
9099
} else if (domain == "ER") {
91-
return(table(data$STUDYID, data$ERTERM, useNA = "ifany")) ###
100+
return(table(data$STUDYID, data$ERTERM, useNA = "ifany"))
92101
} else if (domain == "DD") {
93102
return(table(data$STUDYID, data$DDTEST, useNA = "ifany"))
103+
} else if (domain == "PF") {
104+
return(table(data$STUDYID, data$PFTESTCD, useNA = "ifany"))
105+
} else if (domain == "AU") {
106+
return(table(data$STUDYID, data$AUTESTCD, useNA = "ifany"))
107+
} else if (domain == "PC") {
108+
return(table(data$STUDYID, data$PCTESTCD, useNA = "ifany"))
109+
} else if (domain == "PE") {
110+
return(table(data$STUDYID, data$PETESTCD, useNA = "ifany"))
94111
} else{
95112
warn(str_c(domain, " domain not included in table_variables() function."))
96113
}

man/table_variables.Rd

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)