Skip to content

Instantly share code, notes, and snippets.

@stevenpollack
Created March 22, 2014 19:13
Show Gist options
  • Save stevenpollack/9712662 to your computer and use it in GitHub Desktop.
Save stevenpollack/9712662 to your computer and use it in GitHub Desktop.
check whether a function is an S3 Generic in R
isFuncS3Generic <- function(func) {
funcBody <- body(func)
sum(grepl(pattern="UseMethod", x=funcBody)) != 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment