Skip to content

Commit

Permalink
remove R's pipe operator to allow for further back compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dewittpe committed Mar 1, 2024
1 parent a61615c commit 3a1f1b5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
14 changes: 8 additions & 6 deletions tests/test-phoenix8.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,16 @@ stopifnot(identical(hepatic$expected_score, hepatic$phoenix_hep))

N <- 1e5
DF <-
list(respiratory, cardiovascular, coagulation, neurologic, endocrine, immunolgic, hepatic) |>
lapply(function(DF) {
idx <- sample(1:nrow(DF), size = N, replace = TRUE)
rtn <- DF[idx, ]
list(respiratory, cardiovascular, coagulation, neurologic, endocrine, immunolgic, hepatic)
DF <-
lapply(DF,
function(x) {
idx <- sample(1:nrow(x), size = N, replace = TRUE)
rtn <- x[idx, ]
rtn <- rtn[, -which(names(rtn) == "expected_score")]
rtn
}) |>
do.call(cbind, args = _)
})
DF <- do.call(cbind, args = DF)

DF$creatinine <- NA
DF$phoenix_renal <- NA
Expand Down
7 changes: 5 additions & 2 deletions vignette-spinners/phoenix.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ resp_data <- unique(resp_data)
resp_data$phoenix_respiratory_score <- factor(phoenix_respiratory(pfr, sfr, imv, o2, data = resp_data))

resp_data$oxygen_support <-
interaction(resp_data$imv, resp_data$o2) |>
factor(levels = c("0.0", "0.1", "1.1"), c("No Oxygen Support", "Non-invasive Oxygen Support", "Invasive Oxygen Support"))
factor(
interaction(resp_data$imv, resp_data$o2),
levels = c("0.0", "0.1", "1.1"),
labels = c("No Oxygen Support", "Non-invasive Oxygen Support", "Invasive Oxygen Support")
)

ggplot2::ggplot(data = resp_data) +
ggplot2::theme_classic() +
Expand Down
7 changes: 5 additions & 2 deletions vignettes/phoenix.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,11 @@ resp_data <- unique(resp_data)
resp_data$phoenix_respiratory_score <- factor(phoenix_respiratory(pfr, sfr, imv, o2, data = resp_data))
resp_data$oxygen_support <-
interaction(resp_data$imv, resp_data$o2) |>
factor(levels = c("0.0", "0.1", "1.1"), c("No Oxygen Support", "Non-invasive Oxygen Support", "Invasive Oxygen Support"))
factor(
interaction(resp_data$imv, resp_data$o2),
levels = c("0.0", "0.1", "1.1"),
labels = c("No Oxygen Support", "Non-invasive Oxygen Support", "Invasive Oxygen Support")
)
ggplot2::ggplot(data = resp_data) +
ggplot2::theme_classic() +
Expand Down

0 comments on commit 3a1f1b5

Please sign in to comment.