You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
S4 generic functions are not exported unless a method is also defined #246
Seems like @export in a S4 generic for which no method is defined will be ignored/not properly handled (leads to an empty export() in the NAMESPACE file).
# Functions that take complete partitum and return NAMESPACE lines
ns_export <- function(tag, part) {
if (!is.null.string(tag)) return(export(tag))
# FIXME: check for empty exports (i.e. no name)
default_export(part$object, part)
}
This gave me the idea to try @export <tag> and @exportPattern <pattern>. Both works (i.e. the export works), but there will still be an export() line in the NAMESPACE file.
I confirm @fmichonneau 's observation. The S4 generic is not exported even if a method is defined, at least when the method definition is in a separate file (foo-methods.R) than the generic definition (AllGenerics.R).
Activity
jankowtf commentedon May 6, 2014
I looked around in the code a bit and found this:
This gave me the idea to try
@export <tag>and@exportPattern <pattern>. Both works (i.e. the export works), but there will still be anexport()line in theNAMESPACEfile.fmichonneau commentedon May 6, 2014
I see this behavior even when methods are defined.
jlehtoma commentedon May 8, 2014
I confirm @fmichonneau 's observation. The S4 generic is not exported even if a method is defined, at least when the method definition is in a separate file (foo-methods.R) than the generic definition (AllGenerics.R).
hadley commentedon May 8, 2014
Looks like I'm missing a
default_exportmethod fors4genericjlehtoma commentedon May 8, 2014
Thanks @hadley , fixed it for me.
jankowtf commentedon May 11, 2014
Dito!
Add default_export method for S4 generics.