[Rd] Codoc mismatch for roxygen-documented foo<- functions

Richard Cotton richierocks at gmail.com
Tue May 22 18:26:52 CEST 2012


I have a roxygen2 documented package with functions for getting and
setting an attribute.

#' Get or set the foo attribute.
#'
#' Dummy function!
#'
#' @param x Object to hold the attribute.
#' @param value Value to set the attribute to.
#' @return The get function returns the "foo" attribute of \code{x}.
#' @export
foo <- function(x)
{
  attr(x, "foo")
}

#' @rdname foo
#' @export
`foo<-` <- function(x, value)
{
  attr(x, "foo") <- value
}

If I save the above to foo.R and then do

library(roxygen2)
library(devtools)
package.skeleton("foo", code_files="foo.R")
roxygenize("foo")
check("foo")

then the package checker gives me the warning

Codoc mismatches from documentation object 'foo':
foo<-
  Code: function(x, value)
  Docs: function(x, value, value)

How should I be documenting this sort of setter function?

--
Regards,
Richie

live-analytics.com
4dpiecharts.com



More information about the R-devel mailing list