Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions R/get_sundered_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -434,20 +434,34 @@ get_sundered_data <- function(

if (!is.null(type) && type == "pass") {

sundered_tbl_pass <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == 1) %>%
dplyr::select(-pb_is_good_)
if (uses_numeric_logical(input_tbl)) {
sundered_tbl_pass <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == 1) %>%
dplyr::select(-pb_is_good_)
} else {
sundered_tbl_pass <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == TRUE) %>%
dplyr::select(-pb_is_good_)
}

return(sundered_tbl_pass)
}

if (!is.null(type) && type == "fail") {

sundered_tbl_fail <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == 0) %>%
dplyr::select(-pb_is_good_)
if (uses_numeric_logical(input_tbl)) {
sundered_tbl_fail <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == 0) %>%
dplyr::select(-pb_is_good_)
} else {
sundered_tbl_fail <-
tbl_check_join %>%
dplyr::filter(pb_is_good_ == FALSE) %>%
dplyr::select(-pb_is_good_)
}

return(sundered_tbl_fail)
}
Expand All @@ -468,15 +482,27 @@ get_sundered_data <- function(

if (is.null(type)) {

sundered_tbl_list <-
list(
pass = tbl_check_join %>%
dplyr::filter(pb_is_good_ == 1) %>%
dplyr::select(-pb_is_good_),
fail = tbl_check_join %>%
dplyr::filter(pb_is_good_ == 0) %>%
dplyr::select(-pb_is_good_)
)
if (uses_numeric_logical(input_tbl)) {
sundered_tbl_list <-
list(
pass = tbl_check_join %>%
dplyr::filter(pb_is_good_ == 1) %>%
dplyr::select(-pb_is_good_),
fail = tbl_check_join %>%
dplyr::filter(pb_is_good_ == 0) %>%
dplyr::select(-pb_is_good_)
)
} else {
sundered_tbl_list <-
list(
pass = tbl_check_join %>%
dplyr::filter(pb_is_good_ == TRUE) %>%
dplyr::select(-pb_is_good_),
fail = tbl_check_join %>%
dplyr::filter(pb_is_good_ == FALSE) %>%
dplyr::select(-pb_is_good_)
)
}

return(sundered_tbl_list)
}
Expand Down
4 changes: 2 additions & 2 deletions R/scan_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ probe_interactions <- function(data) {
ggforce::geom_autodensity() +
ggplot2::geom_density2d() +
ggforce::facet_matrix(
rows = ggplot2::vars(gt::everything()), layer.diag = 2, layer.upper = 3,
grid.y.diag = FALSE) +
rows = ggplot2::vars(dplyr::everything()), layer.diag = 2,
layer.upper = 3, grid.y.diag = FALSE, labeller = ggplot2::label_value) +
ggplot2::theme_minimal() +
ggplot2::theme(
axis.text.x = ggplot2::element_text(
Expand Down
26 changes: 26 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,32 @@ is_tbl_mssql <- function(x) {
grepl("sql server|sqlserver", tbl_src_details)
}

is_tbl_duckdb <- function(x) {

if (!is_tbl_dbi(x)) {
return(FALSE)
}

tbl_src_details <- tolower(get_tbl_dbi_src_details(x))
grepl("duckdb", tbl_src_details)
}

is_tbl_sqlite <- function(x) {

if (!is_tbl_dbi(x)) {
return(FALSE)
}

tbl_src_details <- tolower(get_tbl_dbi_src_details(x))
grepl("sqlite", tbl_src_details)
}

# Check if table type requires numeric logical values (1/0) instead of
# logicals
uses_numeric_logical <- function(x) {
is_tbl_mssql(x) || is_tbl_duckdb(x) || is_tbl_sqlite(x)
}

# nocov end

# Generate a label for the `agent` or `informant` object
Expand Down
Loading