문제

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
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top