From eb5f8d87822b2a7019dd10231c59027067f05593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 25 Oct 2021 06:43:19 +0200 Subject: [PATCH 1/2] Avoid reexporting deprecated APIs --- NAMESPACE | 15 +-------------- R/grouped-df.r | 1 + R/reexport-tibble.r | 32 -------------------------------- man/reexports.Rd | 9 +-------- 4 files changed, 3 insertions(+), 54 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index c840cb059a..cc80c97403 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -198,7 +198,6 @@ export(arrange_all) export(arrange_at) export(arrange_if) export(as.tbl) -export(as_data_frame) export(as_label) export(as_tibble) export(auto_copy) @@ -233,8 +232,6 @@ export(cur_group) export(cur_group_id) export(cur_group_rows) export(current_vars) -export(data_frame) -export(data_frame_) export(db_analyze) export(db_begin) export(db_commit) @@ -286,7 +283,6 @@ export(filter_all) export(filter_at) export(filter_if) export(first) -export(frame_data) export(full_join) export(funs) export(funs_) @@ -332,7 +328,6 @@ export(lead) export(left_join) export(location) export(lst) -export(lst_) export(make_tbl) export(matches) export(min_rank) @@ -443,7 +438,6 @@ export(tbl) export(tbl_df) export(tbl_nongroup_vars) export(tbl_ptype) -export(tbl_sum) export(tbl_vars) export(tibble) export(top_frac) @@ -454,7 +448,6 @@ export(transmute_all) export(transmute_at) export(transmute_if) export(tribble) -export(type_sum) export(ungroup) export(union) export(union_all) @@ -479,23 +472,17 @@ importFrom(magrittr,"%>%") importFrom(methods,is) importFrom(pillar,format_glimpse) importFrom(pillar,glimpse) +importFrom(pillar,tbl_sum) importFrom(stats,lag) importFrom(stats,setNames) importFrom(stats,update) importFrom(tibble,add_row) -importFrom(tibble,as_data_frame) importFrom(tibble,as_tibble) -importFrom(tibble,data_frame) -importFrom(tibble,data_frame_) -importFrom(tibble,frame_data) importFrom(tibble,is_tibble) importFrom(tibble,lst) -importFrom(tibble,lst_) importFrom(tibble,new_tibble) -importFrom(tibble,tbl_sum) importFrom(tibble,tibble) importFrom(tibble,tribble) -importFrom(tibble,type_sum) importFrom(tibble,view) importFrom(tidyselect,all_of) importFrom(tidyselect,any_of) diff --git a/R/grouped-df.r b/R/grouped-df.r index 95ae65d496..2c1907d55d 100644 --- a/R/grouped-df.r +++ b/R/grouped-df.r @@ -191,6 +191,7 @@ group_sum <- function(x) { paste0(commas(group_vars(x)), " [", big_mark(grps), "]") } +#' @importFrom pillar tbl_sum #' @export tbl_sum.grouped_df <- function(x, ...) { c( diff --git a/R/reexport-tibble.r b/R/reexport-tibble.r index 7199eeceb8..20cbbd6587 100644 --- a/R/reexport-tibble.r +++ b/R/reexport-tibble.r @@ -1,35 +1,13 @@ # dataframe --------------------------------------------------------------- -#' @importFrom tibble data_frame -#' @export -tibble::data_frame - -#' @importFrom tibble data_frame_ -#' @export -tibble::data_frame_ - -#' @importFrom tibble as_data_frame -#' @export -tibble::as_data_frame - #' @importFrom tibble lst #' @export tibble::lst -#' @importFrom tibble lst_ -#' @export -tibble::lst_ - #' @importFrom tibble add_row #' @export tibble::add_row -# type_sum ---------------------------------------------------------------- - -#' @importFrom tibble type_sum -#' @export -tibble::type_sum - # glimpse ----------------------------------------------------------------- #' Get a glimpse of your data @@ -66,10 +44,6 @@ glimpse # frame-data -------------------------------------------------------------- -#' @importFrom tibble frame_data -#' @export -tibble::frame_data - #' @importFrom tibble tribble #' @export tibble::tribble @@ -84,9 +58,3 @@ tibble::as_tibble #' @importFrom tibble view tibble::view - -# utils ------------------------------------------------------------------- - -#' @importFrom tibble tbl_sum -#' @export -tibble::tbl_sum diff --git a/man/reexports.Rd b/man/reexports.Rd index 094d392bf2..1ea86a6dd5 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -4,19 +4,12 @@ \docType{import} \name{reexports} \alias{reexports} -\alias{data_frame} -\alias{data_frame_} -\alias{as_data_frame} \alias{lst} -\alias{lst_} \alias{add_row} -\alias{type_sum} -\alias{frame_data} \alias{tribble} \alias{tibble} \alias{as_tibble} \alias{view} -\alias{tbl_sum} \alias{contains} \alias{select_helpers} \alias{ends_with} @@ -44,7 +37,7 @@ below to see their documentation. \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} - \item{tibble}{\code{\link[tibble]{add_row}}, \code{\link[tibble:deprecated]{as_data_frame}}, \code{\link[tibble]{as_tibble}}, \code{\link[tibble:deprecated]{data_frame}}, \code{\link[tibble:deprecated]{data_frame_}}, \code{\link[tibble:deprecated]{frame_data}}, \code{\link[tibble]{lst}}, \code{\link[tibble:deprecated]{lst_}}, \code{\link[tibble:reexports]{tbl_sum}}, \code{\link[tibble]{tibble}}, \code{\link[tibble]{tribble}}, \code{\link[tibble:reexports]{type_sum}}, \code{\link[tibble]{view}}} + \item{tibble}{\code{\link[tibble]{add_row}}, \code{\link[tibble]{as_tibble}}, \code{\link[tibble]{lst}}, \code{\link[tibble]{tibble}}, \code{\link[tibble]{tribble}}, \code{\link[tibble]{view}}} \item{tidyselect}{\code{\link[tidyselect]{all_of}}, \code{\link[tidyselect:all_of]{any_of}}, \code{\link[tidyselect:starts_with]{contains}}, \code{\link[tidyselect:starts_with]{ends_with}}, \code{\link[tidyselect]{everything}}, \code{\link[tidyselect:everything]{last_col}}, \code{\link[tidyselect:starts_with]{matches}}, \code{\link[tidyselect:starts_with]{num_range}}, \code{\link[tidyselect]{one_of}}, \code{\link[tidyselect]{starts_with}}} }} From 889b9bb75fdd3b153565f58a6a7fa8fc2f4e0e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 30 Jan 2022 08:29:21 +0100 Subject: [PATCH 2/2] Qualify type_sum --- tests/testthat/test-deprec-do.R | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/testthat/test-deprec-do.R b/tests/testthat/test-deprec-do.R index db6b21df00..149ae11198 100644 --- a/tests/testthat/test-deprec-do.R +++ b/tests/testthat/test-deprec-do.R @@ -105,69 +105,69 @@ test_that("empty data frames give consistent outputs", { dat %>% do(data.frame()) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% length() %>% expect_equal(0) dat %>% do(data.frame(y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(y = "int")) dat %>% do(data.frame(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr")) dat %>% do(data.frame(., y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr", y = "int")) dat %>% do(y = ncol(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(y = "list")) # Grouped data frame should have same col types as ungrouped, with addition # of grouping variable grp %>% do(data.frame()) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr")) grp %>% do(data.frame(y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr", y = "int")) grp %>% do(data.frame(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr")) grp %>% do(data.frame(., y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr", y = "int")) grp %>% do(y = ncol(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr", y = "list")) # A empty grouped dataset should have same types as grp emt %>% do(data.frame()) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr")) emt %>% do(data.frame(y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr", y = "int")) emt %>% do(data.frame(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr")) emt %>% do(data.frame(., y = integer(0))) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(x = "dbl", g = "chr", y = "int")) emt %>% do(y = ncol(.)) %>% - vapply(type_sum, character(1)) %>% + vapply(pillar::type_sum, character(1)) %>% expect_equal(c(g = "chr", y = "list")) })