How to correctly identify and document! method for S4 clas

I am trying to define a method !

for a custom S4 class. Let's say it looks like ( R/foo.R

)

#' Foo
#'
#' @param is_true logical
#' @export
setClass("Foo", slots = list(is_true = "logical"))

#' !
#'
#' Negates Foo
#'
#' @param x Foo
#'
#' @rdname !
#' @name !
#' @aliases !,Foo-method
#' @importFrom methods new
#' @examples
#' !new("Foo", is_true = FALSE)
#' @export
setMethod(
  "!", signature(x = "Foo"),
  function(x) { new("Foo", is_true = !x@is_true) }
)

      

DESCRIPTION

:

Package: foo
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("First", "Last", email = "first.last@example.com", role = c("aut", "cre"))
Description: What the package does (one paragraph).
Depends:
    R (>= 3.3.3)
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 5.0.1
Imports: methods

      

But when I run devtools::check

I get:

Undocumented S4 methods:
  generic '!' and siglist 'Foo'
All user-level objects in a package (including S4 classes and methods)
should have documentation entries.

      

Can anyone please explain what I am not seeing here?

Setting @rdname

:

@rdname Foo

      

seems to partially solve the problem, but introduces another:

* checking Rd files ... WARNING
prepare_Rd: Foo.Rd: \name should not contain !, | or @

      

which makes me think this is not the way to go, even though the generated files rd

look great.

+3
r s4 roxygen2 devtools


source to share


No one has answered this question yet

Check out similar questions:

2474
How to make a great R reproducible example
1251
How to sort a data frame by multiple columns
1068
How to concatenate (merge) data frames (inner, outer, left, right)
291
How to properly document S4 class slots using Roxygen2?
46
How to properly document S4 methods with roxygen2
37
Roxygen2 - how to properly document S3 methods
7
Create the devtools roxygen and rd package
five
R using s3 and s4 methods to simulate in one package
1
S4 class with constructor overload has duplicates in roxygen2 documentation
1
Can't install my generated packages



All Articles
Loading...
X
Show
Funny
Dev
Pics