I am writing a package but one persistent R CMD check
warning prevents me from finishing the package and posting it to CRAN. I use roxygen2
for inline documentation, although that possibly isn't the root cause of the error.
If you know what to do to remove this warning, I can quite possibly figure out a way of doing it using roxygen2
.
How can I remove the warning Functions/methods with usage in documentation object ... but not in code
from my package checks?
The R CMD check
warning:
* checking for code/documentation mismatches ... WARNING
Functions/methods with usage in documentation object 'names<-' but not in code:
names<-
The function and roxygen
documentation:
#' Updates names and variable.labels attribute of surveydata.
#'
#' @name names<-
#' @rdname names
#' @aliases names<- names<-.surveydata
#' @param x surveydata object
#' @param value New names
#' @method names<- surveydata
#' @usage names(x) <- value
"names<-.surveydata" <- function(x, value){
invisible(NULL)
}
The resulting .rd
documentation file:
\name{names<-}
\alias{names<-}
\alias{names<-.surveydata}
\title{Updates names and variable.labels attribute of surveydata.}
\usage{
names(x) <- value
}
\arguments{
\item{x}{surveydata object}
\item{value}{New names}
}
\description{
Updates names and variable.labels attribute of
surveydata.
}
I have cross-checked my documentation with the documentation for names<-
in base R, and it seems identical:
\title{ The Names of an Object}
\name{names}
\alias{names}
\alias{names.default}
\alias{names<-}
\alias{names<-.default}
\keyword{attribute}
\description{Functions to get or set the names of an object.}
Related question (but I have already implemented the suggestion and still no luck):
Where am I going wrong? How can I remove this warning from the package checks?
@usage
section. In my Rd files of similar nature, you want usage to include\method{names}{surveydata}(x) <- value
which should be produce by the@method
section. If it isn't after you delete the@usage
line, then add an explicit@usage
line containing the above? – Adjointroxygen
doesn't generate that usage, hence the override statement. I shall report this as a bug / new feature request. – Dierolfnames.surveydata()
and"names<-.surveydata()"
in the same file, I'd add both in the@usage
, if you are documenting them separately then it doesn't matter. – Adjointroxygen2
is not producing correct output by default, please file a bug report. You also shouldn't need@aliases
,@name
, or@rdname
– Tera