Skip to content

Commit 8e34635

Browse files
committed
Make corr_hm independent from dplyr.
1 parent 0286975 commit 8e34635

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

R/mock_corr_hm.R

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55

66
mock_app_corr_hm <- function(dry_run = FALSE, update_query_string = TRUE, srv_defaults = list(), ui_defaults = list(), anlfl_flags = FALSE) {
77
data <- test_data(random_bm_values = TRUE, anlfl_flags = anlfl_flags)
8+
anlfl_vars <- NULL
9+
if (anlfl_flags) { # drop some observations from ANLFL1
10+
subjid_int <- as.integer(data$bm[["SUBJID"]])
11+
drop_mask <- (16 <= subjid_int & subjid_int <= 20 & data$bm[["ANLFL1"]] == "Y")
12+
data$bm <- data$bm[!drop_mask, ]
13+
anlfl_vars <- c("ANLFL1", "ANLFL2")
14+
}
15+
816
bm_dataset <- shiny::reactive({
917
data[["bm"]]
1018
})
@@ -16,21 +24,6 @@ mock_app_corr_hm <- function(dry_run = FALSE, update_query_string = TRUE, srv_de
1624
ui_defaults
1725
)
1826

19-
if (anlfl_flags) {
20-
21-
# modifying the test data to make them asymetric so that there is visible difference in the calculated values between the two analysis flag variables
22-
data$bm <- dplyr::filter(
23-
data$bm,
24-
!(as.numeric(as.character(.data[["SUBJID"]])) >= 16 &
25-
as.numeric(as.character(.data[["SUBJID"]])) <= 20 &
26-
.data[["ANLFL1"]] == "Y")
27-
)
28-
29-
anlfl_vars <- c("ANLFL1", "ANLFL2")
30-
} else {
31-
anlfl_vars <- NULL
32-
}
33-
3427
srv_params <- c(
3528
list(
3629
id = "not_ebas",
@@ -74,7 +67,7 @@ mock_app_correlation_hm_mm <- function(anlfl_flags = FALSE) {
7467
if (anlfl_flags) { # drop some observations from ANLFL1
7568
subjid_int <- as.integer(bm_dataset[["SUBJID"]])
7669
drop_mask <- (16 <= subjid_int & subjid_int <= 20 & bm_dataset[["ANLFL1"]] == "Y")
77-
bm_dataset <- bm_dataset[!drop_mask,]
70+
bm_dataset <- bm_dataset[!drop_mask, ]
7871
anlfl_vars <- c("ANLFL1", "ANLFL2")
7972
}
8073

0 commit comments

Comments
 (0)