Question

When I build my package I receive this error. Can you help me know what are the steps to avoid this error?

#' Square a number
#' 
#' Takes in any numeric value and squares it
#' @param x A value to be squared
#' @return The square of the input
#' @export
#' @example 
square <- function(x)
{
  return(x^2)
}

Here's the error when I press build:

==> roxygenize('.', roclets=c('rd', 'collate', 'namespace'))

* checking for changes ... ERROR

Error : example requires a value
Was it helpful?

Solution

Try the following:

#' @title
#' Square a number
#' 
#' @description
#' Takes in any numeric value and squares it
#'
#' @param x A value to be squared
#' @return The square of the input
#'
#' @export
#' @examples
#' square(2) # 2 squared
square <- function(x)
{
  return(x^2)
}

Also, make sure you play with the latest roxygen2 package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top