pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Replace “S3 method for default”?

Open msberends opened this issue 3 years ago • 4 comments

I noticed that the latest pkgdown shows “S3 method for default” in Usage for any foo.default() function, e.g. as_tibble.default:

https://tibble.tidyverse.org/reference/as_tibble.html

# S3 method for table
as_tibble(x, `_n` = "n", ..., n = `_n`, .name_repair = "check_unique")

# S3 method for `NULL`
as_tibble(x, ...)

# S3 method for default
as_tibble(x, ...)

The R documentation (at least R4) says “S3 method for class ‘bar’” and for the default function “Default S3 method”, e.g.:

https://stat.ethz.ch/R-manual/R-devel/library/base/html/format.html


## Default S3 method:
format(x, trim = FALSE, digits = NULL, nsmall = 0L,
       justify = c("left", "right", "centre", "none"),
       width = NULL, na.encode = TRUE, scientific = NA,
       big.mark   = "",   big.interval = 3L,
       small.mark = "", small.interval = 5L,
       decimal.mark = getOption("OutDec"),
       zero.print = NULL, drop0trailing = FALSE, ...)

## S3 method for class 'data.frame'
format(x, ..., justify = "none")

Small thing of course, but “S3 method for default” does not sound very natural and is now different from the current R documentation.

I rather like the R4 way. What do you think?

msberends avatar Aug 30 '22 20:08 msberends

For reference this is where this behavior is defined https://github.com/r-lib/pkgdown/blob/956f076f661eb2de9413f64ea24a580cf444466d/R/rd-html.R#L204

maelle avatar Sep 02 '22 07:09 maelle

Ah great. Shall I do a PR?

msberends avatar Sep 02 '22 07:09 msberends

I think it'd be a good idea to open a small PR but I'm not the maintainer :smile_cat:

maelle avatar Sep 02 '22 08:09 maelle

I'll do it and then we'll see what happens 😄

msberends avatar Sep 02 '22 09:09 msberends

This is now continued in the PR, this one can be closed.

msberends avatar Apr 19 '24 06:04 msberends

Note that because of the keyword in your PR's first comment, merging the PR would have closed this issue.

https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

maelle avatar Apr 19 '24 06:04 maelle

Yeah, saw that a couple of seconds later 😅

msberends avatar Apr 19 '24 06:04 msberends