From h.wickham at gmail.com  Wed Jul 31 17:55:34 2013
From: h.wickham at gmail.com (Hadley Wickham)
Date: Wed, 31 Jul 2013 10:55:34 -0500
Subject: [Rd] S3 internal and group generics
Message-ID: <CABdHhvF9m1Qjqz1ifSaWQNcXYSHmPYQwO4rkNXgYA8Y069fa1g@mail.gmail.com>

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
generics"

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?

Thanks!

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/



[Rd] S3 internal and group generics
Hadley Wickham