Search code examples
rnamespacespackagedocumentationdrc

R package NAMESPACE


I am documenting an R function. The structure of my R file is as below:

#'Report the modeling result
#'
#' @param higher_rank A string.
#' @param lower_rank A string.
#' @param method A string.
#' @return modeling result of the accumulation of \code{lower_rank} of a \code{higher_rank} by \code{method}
#' @import data.table
#' @import ggplot2
#' @import drc drm
#' @importFrom plotly ggplotly
#'@examples
#'\dontrun{
#'modelit("adult", "child", "logistic")
#'}
#'@export

modelit <- function(higher_rank, lower_rank, method) {

...
...

model.drm <- drc::drm(lower_rank ~ higher_rank, data = data.frame(adults = adults, children = children), fct = MM.2())

...
...

}

As I ran

>devtools::document()

An error pops up:

Warning messages:
1: In loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘drm’
2: character(0) 
3: character(0) 
4: In loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘drm’

As I do not have a package drm but drc, I am curious where this warning comes from. In NAMESPACE, I do see

importFrom(drm,drc)

I highly appreciate your help. Thank you.


Solution

  • You used the tag @import instead of @importFrom. Thus, you asked for importing the package drminstead of the function drm from drc

    Btw, you don't need any import tag for drm since you called the function by namespace drc::drm