Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S4 generic functions are not exported unless a method is also defined #246

Closed
rappster opened this issue May 6, 2014 · 6 comments
Closed

S4 generic functions are not exported unless a method is also defined #246

rappster opened this issue May 6, 2014 · 6 comments

Comments

@rappster
Copy link

@rappster rappster commented May 6, 2014

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).

An illustration can be found at this stackoverflow post.

Best regards and thanks for the great work with roxygen/roxygen2!
Janko

@rappster
Copy link
Author

@rappster rappster commented May 6, 2014

I looked around in the code a bit and found this:

# 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.

@fmichonneau
Copy link
Contributor

@fmichonneau fmichonneau commented May 6, 2014

I see this behavior even when methods are defined.

@jlehtoma
Copy link

@jlehtoma jlehtoma commented 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
Copy link
Member

@hadley hadley commented May 8, 2014

Looks like I'm missing a default_export method for s4generic

@hadley hadley closed this in 4bdd629 May 8, 2014
@jlehtoma
Copy link

@jlehtoma jlehtoma commented May 8, 2014

Thanks @hadley , fixed it for me.

@rappster
Copy link
Author

@rappster rappster commented May 11, 2014

Dito!

kevinushey added a commit to kevinushey/roxygen that referenced this issue Aug 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants