I'm writing an R package and currently running R CMD check
via devtools::check()
I have the following roxygen2
in two of my functions that reference an S4 class (both functions return objects of this class):
#' @return An object of class \code{\link{mod_imputeMulti}}
#' @aliases mod_imputeMulti
#' @seealso \code{\link{multinomial_em}}, \code{\link{multinomial_impute}}
Yet I get the following WARNING:
Rd files with duplicated alias 'mod_imputeMulti':
'multinomial_data_aug.Rd' 'multinomial_em.Rd'
If I don't use second line -- the @aliases
tag, I get this WARNING, despite the fact that I do have a link:
checking Rd cross-references ... WARNING
Missing link or links in documentation object 'multinomial_data_aug.Rd': 'mod_imputeMulti'Missing link or links in documentation object 'multinomial_em.Rd': 'mod_imputeMulti'
See section 'Cross-references' in the 'Writing R Extensions' manual.
Note: adding \code{\link{mod_imputeMulti}}
to @seealso
doesn't change this (second) WARNING
What is the correct syntax?
I've looked at a lot of references but can't find the solution anywhere:
I hope this is an easy one for someone--thanks in advance for the help!
Edit:
The S4 class documenation is provided below:
#' Class "mod_imputeMulti"
#'
#' @name mod_imputeMulti-class
#' @description A multivariate multinomial model imputed by EM or Data Augmentation is
#' represented as a \code{\linkS4class{mod_imputeMulti}} object. A complete
#' dataset and model is represented as an \code{\linkS4class{imputeMulti}} object.
#' Slots for \code{mod_imputeMulti} objects include: (1) the modeling method;
#' (2) the call to the estimation function; (3) the number of iterations in estimation;
#' (4) the final log-likelihood; (5) the conjugate prior if any; (6) the MLE estimate of
#' the sufficient statistics and parameters.
#' @docType class
#' @section Objects from the class: Objects are created by calls to
#' \code{\link{multinomial_impute}}, \code{\link{multinomial_em}}, or
#' \code{\link{multinomial_data_aug}}.
#' @seealso \code{\link{multinomial_impute}}, \code{\link{multinomial_em}},
#' \code{\link{multinomial_data_aug}}
#' @export
setClass("mod_imputeMulti",
representation= list(
method= "character",
mle_call= "call",
mle_iter= "numeric",
mle_log_lik= "numeric",
mle_cp= "character",
mle_x_y= "data.frame"),
validity= function(object) {
if (!object@method %in% c("EM", "DA", "NULL")) {
return("Currently only EM and DA methods are defined.")
} else if (object@mle_iter < 0) {
return("A negative iteration was given.")
}
return(TRUE)
}
)