文献R包给出警告@example不存在。

问题描述 投票:0回答:1

我试图在R中建立一个新的包,但是每次我试图用devtools document()函数来记录这个包的时候,它都会给我一个找不到例子的错误。具体的错误是这样的。

警告: [C:\Users\User\Desktop/RProject\ExcelFunctionsR/RAND.R:9] @例子'C:\Users\User\Desktop/RProject\ExcelFunctionsRAND(iris$Species == "setosa", iris$Petal.Length == 1.4)'不存在。

你们谁知道这个错误可能是什么。这是函数本身(其他函数也返回同样的警告)

# COUNT Function from Excel
#' Basic COUNT function from excel
#'
#' It acts similiarly to Excel's COUNT function.
#'
#' @param value Count amount of the values in the range.
#' @import base
#' @import plyr
#' @export
#' @example
#' COUNT(iris$Species)

COUNT <-
function(value){

  sum(count(value)[,2]) - sum(is.na(value))

}
r r-package
1个回答
3
投票

你想使用@examples而不是@example。

@example指令是在你想使用一个包含例子的外部文件时使用的。 如果你在你的 roxygen 文档中直接包含了例子,那么就使用 @examples。

注意,这就是为什么它抱怨文件不存在的原因。 在你的'AND.R'文件中,你想使用的例子可能是 "AND(iris$Species == "setosa", iris$Petal.Length == 1.4)",所以它试图在目录中寻找一个名为 "AND(iris$Species == "setosa", iris$Petal.Length == 1.4) "的文件。

© www.soinside.com 2019 - 2024. All rights reserved.