R CMD check warning: Functions/methods with usage in documentation object … but not in code

前端 未结 2 1260
轮回少年
轮回少年 2021-02-05 06:48

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

相关标签:
2条回答
  • 2021-02-05 07:28

    The \usage section in the Rd file needs to include the following:

    \method{names}{surveydata}(x) <- value
    

    If this is not automatically inserted by the @method line (I presume that will only add \method{names}{surveydata}(x)?) then you need an explicit @usage section that includes the above. Something like

    #' @usage \\method{names}{surveydata}(x) <- value
    

    I would also change the @name and @alias sections to refer to the method explicitly not the generic as that will clash with the Rd file in R::base.

    Essentially, the warning is coming from the fact that your package doesn't contains a function "names<-" yet you are using this in \usage{}.

    0 讨论(0)
  • 2021-02-05 07:33

    In case it helps anyone, this error can also arise from an abandoned Rd file for which a function or data object no longer exists.

    0 讨论(0)
提交回复
热议问题