[Rd] S3 internal and group generics

Hadley Wickham h.wickham at gmail.com
Wed Jul 31 17:55:34 CEST 2013

Hi all,

I've noticed a couple of small bugs/documentation errors related to S3
internal and group generics:

* In ?S3groupGeneric, log2 and log10 are not listed as group generics,
even though they are in the equivalent S4 groups, and are the source
code for do_log1arg contains DispatchGroup("Math", ...)

* As well as log2 and log10, tools:::.get_internal_S3_generics() fails
to include cbind and rbind, even though they are listed in ?"internal

Based on my reading of the documentation and the source code, I
believe this function lists all S3 internal generics:

s3_internal <- function(fname) {
  # Functions in S4 group generics should be the same
  group <- c(getGroupMembers("Arith"), getGroupMembers("Compare"),
    getGroupMembers("Logic"), getGroupMembers("Math"), getGroupMembers("Math2"),
    getGroupMembers("Summary"), getGroupMembers("Complex"))

  primitive <- .S3PrimitiveGenerics

  # Extracted from ?"internal generic"
  internal <- c("[", "[[", "$", "[<-", "[[<-", "$<-", "unlist",
    "cbind", "rbind", "as.vector")

  c(group, primitive, internal)

Have I missed anything?



Chief Scientist, RStudio

More information about the R-devel mailing list