What is the correct way of roxygen
documenting a function with an optional parameter like
#' @name dbh2vol
#' @usage dbh2vol(dbh,ipft)
#' @description This is an allometric function to return the tree volume
#' @param dbh diameter at breast height
#' @param ipft PFT
#' @return vol volume
#' @export
dbh2vol <- function(dbh,ipft,...,hgt, chambers = FALSE){
if (missing(hgt)) hgt = other_function (dbh, ipft)
vol = hgt * dbh ^ pft$vol[ipft]
if (chambers) vol = vol * 2
return(vol)
}
In particular how should one comment on the optional parameters chambers
and hgt
?
@param
entries for them...? – Pelusohgt
andchambers
are inherently different from the others in the sense that they are optional. One of them is set toTRUE
while the other calls an external function. What is the correct way to inform the reader of the documentation about this? – LuxuriateFALSE
orNULL
. E.g.Fun = function(data, weights=NULL, adjust=FALSE, verbose=FALSE, plot.it=TRUE){
. In the@param
and@details
sections, you add as much description as is necessary for the user to understand and use the function correctly. – Belle