I want to export an S3method named [.myclass using roxygen2 and I can't see a clean way to do this.
I need NAMESPACE to have
S3method("[",myclass)
in it or the method can't be used after I require the package, but roxygen2 doesn't appear to want to help me with this.
I can force it to with
#' @S3method [ myclass
setMethodS3("[",
c(x="myclass"),
function(x,i) {
blah blah balh
})
but roxygen then says that s3method is deprecated and that I should use @export instead, but
#' @export
setMethodS3("[",
c(x="myclass"),
function(x,i) {
blah blah balh
})
just doesn't do it. (puts an empty export in the NAMESPACE).
I asked the author of the package and he suggested i use @method and @export, but this also doesn't work
#' @method [ myclass
#' @export
setMethodS3("[",
c(x="myclass"),
function(x,i) {
blah blah balh
})
also ends up with "export()" in the NAMESPACE
What am I missing?
Answer:
Hadley was incredibly helpful and now I realize that I shouldn't be using setMethodS3 but instead just
#' @method [ myclass
#' @export
"[.myclass" <- function(x,i) { blah blah blah }
and then everything works great.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With