Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Hard-deprecate, add ellipsis #492

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ importFrom(fansi,strip_sgr)
importFrom(fansi,substr2_ctl)
importFrom(glue,as_glue)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecate_stop)
importFrom(utf8,utf8_width)
importFrom(utils,head)
importFrom(utils,str)
Expand Down
2 changes: 1 addition & 1 deletion R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ NULL
#' @export
#' @rdname deprecated
is_vector_s3 <- function(x) {
deprecate_soft("1.4.4", "pillar::is_vector_s3()", "vctrs::vec_is()")
deprecate_stop("1.4.4", "pillar::is_vector_s3()", "vctrs::vec_is()")
vec_is(x)
}
18 changes: 3 additions & 15 deletions R/multi.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,8 @@
#' @inheritParams ellipsis::dots_empty
#' @keywords internal
#' @export
#' @examples
#' colonnade(list(a = 1:3, b = letters[1:3]))
#'
#' long_string <- list(paste(letters, collapse = " "))
#' colonnade(long_string, width = 20)
#' colonnade(long_string, has_row_id = FALSE, width = 20)
#'
#' # The width can also be overridden when calling format() or print():
#' print(colonnade(long_string), width = 20)
#'
#' # If width is larger than getOption("width"), multiple tiers are created:
#' colonnade(rep(long_string, 4), width = Inf)
colonnade <- function(x, has_row_id = TRUE, width = NULL, ...) {
deprecate_soft("1.6.6", "pillar::colonnade()", "pillar::tbl_format_setup()")
deprecate_stop("1.6.6", "pillar::colonnade()", "pillar::tbl_format_setup()")

if (!missing(...)) {
check_dots_empty(action = warn)
Expand Down Expand Up @@ -127,7 +115,7 @@ new_empty_col_sentinel <- function(type) {
#' @keywords internal
#' @export
squeeze <- function(x, width = NULL, ...) {
deprecate_soft("1.5.0", "pillar::squeeze()")
deprecate_stop("1.5.0", "pillar::squeeze()")

squeeze_impl(x, width, ...)
}
Expand Down Expand Up @@ -244,7 +232,7 @@ knit_print_squeezed_colonnade_tier <- function(x) {
#' @keywords internal
#' @export
extra_cols <- function(x, ...) {
deprecate_soft("1.5.0", "pillar::extra_cols()")
deprecate_stop("1.5.0", "pillar::extra_cols()")

if (!missing(...)) {
check_dots_used(action = warn)
Expand Down
4 changes: 2 additions & 2 deletions R/shaft-.R
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ pillar_shaft.Surv2 <- function(x, ...) {
}

#' @export
type_sum.Surv <- function(x) {
type_sum.Surv <- function(x, ...) {
"Surv"
}

#' @export
type_sum.Surv2 <- function(x) {
type_sum.Surv2 <- function(x, ...) {
"Surv2"
}

Expand Down
7 changes: 4 additions & 3 deletions R/tbl-sum.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
#' @return A named character vector, describing the dimensions in the first element
#' and the data source in the name of the first element.
#'
#' @inheritParams type_sum
#' @seealso [pillar::type_sum()]
#' @param x Object to summarise.
#' @export
tbl_sum <- function(x) {
tbl_sum <- function(x, ...) {
UseMethod("tbl_sum", x)
}

#' @export
tbl_sum.default <- function(x) {
tbl_sum.default <- function(x, ...) {
c("Description" = obj_sum(x))
}

#' @export
tbl_sum.tbl <- function(x) {
tbl_sum.tbl <- function(x, ...) {
c("A data frame" = dim_desc(x))
}
2 changes: 1 addition & 1 deletion R/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @keywords internal
#' @export
expect_known_display <- function(object, file, ..., width = 80L, crayon = TRUE) {
lifecycle::deprecate_soft(
lifecycle::deprecate_stop(
"1.6.5", "pillar::expect_known_display()",
"testthat::expect_snapshot()"
)
Expand Down
22 changes: 13 additions & 9 deletions R/type-sum.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,29 @@
#' @param x an object to summarise. Generally only methods of atomic vectors
#' and variants have been implemented.
#'
#' @param ... Must be empty.
#'
#' @export
type_sum <- function(x) {
type_sum <- function(x, ...) {
check_dots_empty()

UseMethod("type_sum")
}

#' @export
type_sum.ordered <- function(x) {
type_sum.ordered <- function(x, ...) {
# r-lib/vctrs#323:
type_sum.default(x)
}

#' @export
type_sum.factor <- function(x) {
type_sum.factor <- function(x, ...) {
# r-lib/vctrs#323:
"fct"
}

#' @export
type_sum.default <- function(x) {
type_sum.default <- function(x, ...) {
pillar_attr <- attr(x, "pillar", exact = TRUE)

label <- pillar_attr$label
Expand Down Expand Up @@ -81,12 +85,12 @@ vec_ptype_abbr.pillar_empty_col <- function(x, ...) {
#' obj_sum(mean)
#' @rdname type_sum
#' @export
obj_sum <- function(x) {
obj_sum <- function(x, ...) {
UseMethod("obj_sum")
}

#' @export
obj_sum.default <- function(x) {
obj_sum.default <- function(x, ...) {
if (!vec_is(x)) {
type_sum(x)
} else {
Expand All @@ -104,7 +108,7 @@ obj_sum.default <- function(x) {
}

#' @export
obj_sum.AsIs <- function(x) {
obj_sum.AsIs <- function(x, ...) {
paste0("I(", obj_sum(remove_as_is_class(x)), ")")
}

Expand All @@ -122,12 +126,12 @@ obj_sum.AsIs <- function(x) {
#' size_sum(Titanic)
#' @rdname type_sum
#' @export
size_sum <- function(x) {
size_sum <- function(x, ...) {
UseMethod("size_sum")
}

#' @export
size_sum.default <- function(x) {
size_sum.default <- function(x, ...) {
if (!vec_is(x)) {
return("")
}
Expand Down
2 changes: 1 addition & 1 deletion R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ format_type_sum <- function(x, width, ...) {
}

# https://github.com/r-lib/pkgdown/issues/1540
type_sum.accel <- function(x) {
type_sum.accel <- function(x, ...) {
I("kg m/s^2")
}

Expand Down
2 changes: 1 addition & 1 deletion R/vctrs.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pillar_shaft.vctrs_vctr <- function(x, ...) {
}

#' @export
type_sum.vctrs_vctr <- function(x) {
type_sum.vctrs_vctr <- function(x, ...) {
pillar_attr <- attr(x, "pillar", exact = TRUE)

label <- pillar_attr$label
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @import rlang
#' @import ellipsis
#' @importFrom glue as_glue
#' @importFrom lifecycle deprecate_soft
#' @importFrom lifecycle deprecate_soft deprecate_stop
#' @importFrom vctrs data_frame
#' @importFrom vctrs new_data_frame
#' @importFrom vctrs new_list_of
Expand Down
13 changes: 0 additions & 13 deletions man/colonnade.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/tbl_sum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/type_sum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 62 additions & 4 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,66 @@
# Revdeps

## New problems (1)
## Failed to check (20)

|package |version |error |warning |note |
|:----------------------------|:-------|:-----|:-------|:----|
|[RNeXML](problems.md#rnexml) |2.4.5 | |__+1__ | |
|package |version |error |warning |note |
|:------------------|:-------|:-----|:-------|:----|
|accept |? | | | |
|bayesZIB |0.0.2 |1 | | |
|conos |1.4.5 |1 | | |
|ctsem |3.5.4 |1 | | |
|densEstBayes |1.0-2 |1 | | |
|diveR |? | | | |
|geocmeans |? | | | |
|ImputeRobust |? | | | |
|lidaRtRee |? | | | |
|loon.ggplot |? | | | |
|loon.shiny |? | | | |
|loon.tourr |? | | | |
|MarketMatching |? | | | |
|missSBM |1.0.1 |1 | | |
|PLNmodels |0.11.5 |1 | | |
|qmix |0.1.2.0 |1 | | |
|referenceIntervals |? | | | |
|SPORTSCausal |? | | | |
|valse |0.1-0 |1 | | |
|vivid |? | | | |

## New problems (34)

|package |version |error |warning |note |
|:----------------------------------------------------------|:-------|:------|:-------|:----|
|[akc](problems.md#akc) |0.9.6 |__+1__ |__+1__ | |
|[anomalize](problems.md#anomalize) |0.2.2 |__+1__ |__+1__ | |
|[arulesViz](problems.md#arulesviz) |1.5-1 |__+1__ | |1 |
|[cellranger](problems.md#cellranger) |1.1.0 |__+1__ | |1 |
|[chunked](problems.md#chunked) |0.5.1 |__+1__ | |1 |
|[dplyr](problems.md#dplyr) |1.0.7 | |__+1__ |1 |
|[edeaR](problems.md#edear) |0.8.6 | |__+1__ |1 |
|[egor](problems.md#egor) |1.22.1 |__+1__ |__+1__ | |
|[ergm.ego](problems.md#ergmego) |1.0.0 |__+1__ | | |
|[fastRG](problems.md#fastrg) |0.3.0 |__+1__ | |2 |
|[ggraph](problems.md#ggraph) |2.0.5 | |__+1__ |1 |
|[malan](problems.md#malan) |1.0.2 | |__+1__ |1 |
|[migraph](problems.md#migraph) |0.8.13 |__+1__ |__+1__ | |
|[multidplyr](problems.md#multidplyr) |0.1.1 |__+2__ |__+1__ | |
|[multinma](problems.md#multinma) |0.4.0 |__+1__ | |2 |
|[panelr](problems.md#panelr) |0.7.6 |__+1__ |__+1__ |1 |
|[photobiology](problems.md#photobiology) |0.10.8 |__+1__ |__+1__ | |
|[photobiologyFilters](problems.md#photobiologyfilters) |0.5.2 |__+1__ |__+1__ | |
|[photobiologyInOut](problems.md#photobiologyinout) |0.4.23 |__+1__ |__+1__ |1 |
|[photobiologyLamps](problems.md#photobiologylamps) |0.4.3 |__+1__ |__+1__ |2 |
|[photobiologyLEDs](problems.md#photobiologyleds) |0.4.3-1 |__+1__ | | |
|[photobiologySensors](problems.md#photobiologysensors) |0.5.0 |__+1__ |__+1__ | |
|[photobiologySun](problems.md#photobiologysun) |0.4.1 | |__+1__ | |
|[photobiologyWavebands](problems.md#photobiologywavebands) |0.4.5 | |__+1__ | |
|[prt](problems.md#prt) |0.1.4 |__+2__ |__+1__ | |
|[readtext](problems.md#readtext) |0.81 |__+1__ |__+1__ |1 |
|[ricu](problems.md#ricu) |0.5.1 |__+1__ |__+1__ |1 |
|[saeSim](problems.md#saesim) |0.10.0 |__+2__ |__+1__ | |
|[sfnetworks](problems.md#sfnetworks) |0.5.4 |__+1__ |__+1__ | |
|[tibble](problems.md#tibble) |3.1.6 |__+1__ | | |
|[tibbletime](problems.md#tibbletime) |0.1.6 |__+2__ |__+1__ | |
|[tidygraph](problems.md#tidygraph) |1.2.0 |__+1__ | |1 |
|[tidyseurat](problems.md#tidyseurat) |0.3.0 |__+1__ |__+1__ | |
|[wordgraph](problems.md#wordgraph) |0.1.0 |__+1__ | |1 |

Loading