From richierocks at gmail.com  Tue May 22 18:26:52 2012
From: richierocks at gmail.com (Richard Cotton)
Date: Tue, 22 May 2012 17:26:52 +0100
Subject: [Rd] Codoc mismatch for roxygen-documented foo<- functions
Message-ID: <CAPp_+=f0-bgiXOENpqjhr_ZXs+yPyu9OO410Qx-qF5LBoiNt+g@mail.gmail.com>

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



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