Skip to content

Commit

Permalink
Avoid superseded tidyselect::one_of() and use tidyselect::all_of()
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Nov 26, 2024
1 parent 66c42d6 commit a85658b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions R/get_sundered_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ get_sundered_data <- function(
tbl_check_join <-
tbl_check_join %>%
dplyr::select(
dplyr::one_of(by_cols), dplyr::starts_with("pb_is_good_")
dplyr::all_of(by_cols), dplyr::starts_with("pb_is_good_")
) %>%
dplyr::left_join(
tbl_check_join_r %>%
dplyr::rename(!!new_col_ii := pb_is_good_) %>%
dplyr::select(
dplyr::one_of(by_cols), dplyr::starts_with("pb_is_good_")
dplyr::all_of(by_cols), dplyr::starts_with("pb_is_good_")
),
by = by_cols
) %>%
Expand Down Expand Up @@ -425,7 +425,7 @@ get_sundered_data <- function(
tbl_check_join <-
tbl_check_join %>%
dplyr::mutate(pb_is_good_ = !!rlang::parse_expr(columns_str_add)) %>%
dplyr::select(-dplyr::one_of(columns_str_vec)) %>%
dplyr::select(-dplyr::all_of(columns_str_vec)) %>%
dplyr::mutate(pb_is_good_ = dplyr::case_when(
pb_is_good_ == validation_n ~ TRUE,
TRUE ~ FALSE
Expand Down
2 changes: 1 addition & 1 deletion R/interrogate.R
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ interrogate <- function(

tbl_checked %>%
dplyr::mutate(pb_is_good_ = !!rlang::parse_expr(columns_str_add)) %>%
dplyr::select(-dplyr::one_of(columns_str_vec)) %>%
dplyr::select(-dplyr::all_of(columns_str_vec)) %>%
dplyr::mutate(pb_is_good_ = dplyr::case_when(
pb_is_good_ == validation_n ~ TRUE,
TRUE ~ FALSE
Expand Down
6 changes: 3 additions & 3 deletions R/scan_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ probe_interactions <- function(data) {
columns_char, FUN.VALUE = integer(1), USE.NAMES = FALSE,
FUN = function(x) {
data %>%
dplyr::select(dplyr::one_of(x)) %>%
dplyr::select(dplyr::all_of(x)) %>%
dplyr::distinct() %>%
dplyr::count() %>%
dplyr::pull(n)
Expand All @@ -1317,7 +1317,7 @@ probe_interactions <- function(data) {
# Create a ggplot2 plot matrix with the data
plot_matrix <-
data %>%
dplyr::select(dplyr::one_of(col_names)) %>%
dplyr::select(dplyr::all_of(col_names)) %>%
ggplot2::ggplot(ggplot2::aes(x = .panel_x, y = .panel_y)) +
ggplot2::geom_point(alpha = 0.50, shape = 16, size = 1) +
ggforce::geom_autodensity() +
Expand Down Expand Up @@ -1388,7 +1388,7 @@ probe_correlations <- function(data) {
)
}

data_corr <- dplyr::select(data, dplyr::one_of(columns_numeric))
data_corr <- dplyr::select(data, dplyr::all_of(columns_numeric))

corr_pearson <-
stats::cor(data_corr, method = "pearson", use = "pairwise.complete.obs")
Expand Down
4 changes: 0 additions & 4 deletions R/tbl_from_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,6 @@ db_tbl <- function(
x
}

# nolint start

RPostgres_driver <- function() {
rlang::check_installed("RPostgres", "to access a PostgreSQL table.")
RPostgres::Postgres()
Expand All @@ -540,8 +538,6 @@ RSQLite_driver <- function() {
RSQLite::SQLite()
}

# nolint end

unknown_driver <- function() {

stop(
Expand Down
6 changes: 3 additions & 3 deletions R/utils-profiling.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ get_tbl_dbi_missing_tbl <- function(data) {

missing_n_span <-
data %>%
dplyr::select(1, dplyr::one_of(x__))
dplyr::select(1, dplyr::all_of(x__))

if (ncol(missing_n_span) == 1) {

Expand Down Expand Up @@ -460,7 +460,7 @@ get_tbl_df_missing_tbl <- function(data) {
col_names,
FUN = function(x__) {

data <- dplyr::select(data, dplyr::one_of(x__))
data <- dplyr::select(data, dplyr::all_of(x__))
data <- tibble::rowid_to_column(data)
data <-
dplyr::mutate(data, `::cut_group::` = dplyr::case_when(
Expand Down Expand Up @@ -524,7 +524,7 @@ get_missing_by_column_tbl <- function(data) {
col_names,
FUN = function(x__) {

data <- dplyr::select(data, dplyr::one_of(x__))
data <- dplyr::select(data, dplyr::all_of(x__))
data <- dplyr::group_by(data)
data <-
dplyr::summarize_all(
Expand Down

0 comments on commit a85658b

Please sign in to comment.