Documeting R package gives warning @example doesnt exist

Viewed 296

I am trying to build a new package in R but every time I try to document the package with devtools document() function it gives me the error that it couldn't find the example. Exact error is like this:

Warning: [C:\Users\User\Desktop\RProject\ExcelFunctionsR\R\AND.R:9] @example 'C:\Users\User\Desktop\RProject\ExcelFunctionsR/AND(iris$Species == "setosa", iris$Petal.Length == 1.4)' doesn't exist

Do any of you know what this error could be. This is the function itself(Other functions return the same warning as well)

# 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))

}
1 Answers

You want to use @examples instead of @example

The @example directive is used when you want to use an external file that contains the examples. If you're including the example(s) directly in your roxygen documentation then use @examples.

Note that this is why it's complaining about a file not existing. In your 'AND.R' file the example you wanted to use was probably "AND(iris$Species == "setosa", iris$Petal.Length == 1.4)" so it tried to look for a file named "AND(iris$Species == "setosa", iris$Petal.Length == 1.4)" in the directory.

Related