From dbeb543f11df79db8b020a79fb8b99915ee303db Mon Sep 17 00:00:00 2001 From: Romain Francois Date: Wed, 2 Feb 2022 13:44:00 +0100 Subject: [PATCH 1/4] because was gettin ``` Warning message: Topic 'glimpse': no parameters to inherit with @inheritParams ``` --- R/reexport-tibble.r | 1 - 1 file changed, 1 deletion(-) diff --git a/R/reexport-tibble.r b/R/reexport-tibble.r index 7199eeceb8..3c6cda7256 100644 --- a/R/reexport-tibble.r +++ b/R/reexport-tibble.r @@ -46,7 +46,6 @@ tibble::type_sum #' `glimpse()` is provided by the pillar package, and re-exported #' by dplyr. See [pillar::glimpse()] for more details. #' -#' @inheritParams pillar::glimpse #' @return x original x is (invisibly) returned, allowing `glimpse()` to be #' used within a data pipeline. #' @examples From a87649c52e8378b1703452bb2df77571e5e30208 Mon Sep 17 00:00:00 2001 From: Romain Francois Date: Wed, 2 Feb 2022 15:11:30 +0100 Subject: [PATCH 2/4] dplyr_col_select() marked as data.table aware so that e.g. attributes are kept --- R/generics.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/generics.R b/R/generics.R index ef80b01f14..8e0c3493b4 100644 --- a/R/generics.R +++ b/R/generics.R @@ -215,6 +215,7 @@ dplyr_reconstruct.rowwise_df <- function(data, template) { dplyr_col_select <- function(.data, loc, names = NULL, error_call = caller_env()) { loc <- vec_as_location(loc, n = ncol(.data), names = names(.data)) + .datatable.aware <- TRUE out <- .data[loc] if (!inherits(out, "data.frame")) { classes_data <- glue_collapse(class(.data), sep = "/") From 48b57f1dd7355f5dbc154d676e0104bbf11b5066 Mon Sep 17 00:00:00 2001 From: Romain Francois Date: Wed, 2 Feb 2022 16:11:11 +0100 Subject: [PATCH 3/4] dplyr_col_select() also reconstruct bare data.table for attribute keeping. --- R/generics.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/generics.R b/R/generics.R index 8e0c3493b4..a8fde91c9d 100644 --- a/R/generics.R +++ b/R/generics.R @@ -215,7 +215,6 @@ dplyr_reconstruct.rowwise_df <- function(data, template) { dplyr_col_select <- function(.data, loc, names = NULL, error_call = caller_env()) { loc <- vec_as_location(loc, n = ncol(.data), names = names(.data)) - .datatable.aware <- TRUE out <- .data[loc] if (!inherits(out, "data.frame")) { classes_data <- glue_collapse(class(.data), sep = "/") @@ -241,7 +240,7 @@ dplyr_col_select <- function(.data, loc, names = NULL, error_call = caller_env() # Patch base data frames to restore extra attributes that `[.data.frame` drops. # We require `[` methods to keep extra attributes for all data frame subclasses. - if (identical(class(.data), "data.frame")) { + if (identical(class(.data), "data.frame") || identical(class(.data), c("data.table", "data.frame"))) { out <- dplyr_reconstruct(out, .data) } From 3e72594683a26c054b6fc7e2923bf2fd625a1142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Fran=C3=A7ois?= Date: Wed, 2 Feb 2022 16:37:50 +0100 Subject: [PATCH 4/4] mention this pr in comment --- R/generics.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/generics.R b/R/generics.R index a8fde91c9d..e931fe7780 100644 --- a/R/generics.R +++ b/R/generics.R @@ -238,7 +238,7 @@ dplyr_col_select <- function(.data, loc, names = NULL, error_call = caller_env() abort(bullets, call = error_call) } - # Patch base data frames to restore extra attributes that `[.data.frame` drops. + # Patch base data frames and data.table (#6171) to restore extra attributes that `[.data.frame` drops. # We require `[` methods to keep extra attributes for all data frame subclasses. if (identical(class(.data), "data.frame") || identical(class(.data), c("data.table", "data.frame"))) { out <- dplyr_reconstruct(out, .data)