Skip to content

Commit

Permalink
@gogonzo suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Jun 24, 2024
1 parent 2495481 commit e7ac08c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -683,28 +683,32 @@ srv_g_correlationplot <- function(id,
ANL_TRANSPOSED <- merge(ANL_TRANSPOSED1, ANL_TRANSPOSED2) # nolint
ANL_TRANSPOSED <- ANL_TRANSPOSED %>%
dplyr::mutate(
x_temp = ifelse(
xloqfl_temp = dplyr::case_when(
.data[[.(xloqfl())]] == "Y" & (
(grepl("<", .data[[.(xlabs())]]) & .data[[.(xvar())]] < as.numeric(gsub("[^0-9.-]", "", .data[[.(xlabs())]]))) |
(grepl(">", .data[[.(xlabs())]]) & .data[[.(xvar())]] > as.numeric(gsub("[^0-9.-]", "", .data[[.(xlabs())]])))
), "Y", ifelse(.data[[.(xloqfl())]] == "Y", "N", as.character(.data[[.(xloqfl())]]))
) ~ "Y",

This comment has been minimized.

Copy link
@kartikeyakirar

kartikeyakirar Jun 24, 2024

Author Contributor

there's an|operator between the two grepl expressions, that's why I need to make sure the logical grouping is correctly handled there with (

.data[[.(xloqfl())]] == "Y" ~ "N",
TRUE ~ as.character(.data[[.(xloqfl())]])
),
y_temp = ifelse(
yloqfl_temp = dplyr::case_when(
.data[[.(yloqfl())]] == "Y" & (
(grepl("<", .data[[.(ylabs())]]) & .data[[.(yvar())]] < as.numeric(gsub("[^0-9.-]", "", .data[[.(ylabs())]]))) |
(grepl(">", .data[[.(ylabs())]]) & .data[[.(yvar())]] > as.numeric(gsub("[^0-9.-]", "", .data[[.(ylabs())]])))
), "Y", ifelse(.data[[.(yloqfl())]] == "Y", "N", as.character(.data[[.(yloqfl())]]))
) ~ "Y",
.data[[.(yloqfl())]] == "Y" ~ "N",
TRUE ~ as.character(.data[[.(yloqfl())]])
)
) %>%
dplyr::mutate(LOQFL_COMB = dplyr::case_when(
x_temp == "Y" | y_temp == "Y" ~ "Y",
x_temp == "N" & y_temp == "N" ~ "N",
x_temp == "N" & y_temp == "NA" ~ "N",
x_temp == "NA" & y_temp == "N" ~ "N",
x_temp == "NA" & y_temp == "NA" ~ "NA",
xloqfl_temp == "Y" | yloqfl_temp == "Y" ~ "Y",
xloqfl_temp == "N" & yloqfl_temp == "N" ~ "N",
xloqfl_temp == "N" & yloqfl_temp == "NA" ~ "N",
xloqfl_temp == "NA" & yloqfl_temp == "N" ~ "N",
xloqfl_temp == "NA" & yloqfl_temp == "NA" ~ "NA",
TRUE ~ as.character(NA)
)) %>%
dplyr::select(-x_temp, -y_temp)
dplyr::select(-xloqfl_temp, -yloqfl_temp)
})
)

Expand Down

0 comments on commit e7ac08c

Please sign in to comment.