Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

roxygen2 "Error: titlerequires a value"

I'm receiving an error from roxygenize() that I can't understand. I have a package of my miscellaneous functions in which the .Rd files are generated via roxygen.

The error is Error: titlerequires a value, which suggests that there is no @title tag. However there is an @title tag in the kmmisc-package.R file, so I'm not sure what the problem is.

kmmisc-package.R contains:

##' Miscellaneous Functions
##' 
##' \tabular{ll}{
##' Package: \tab kmmisc\cr
##' Type: \tab Package\cr
##' Version: \tab 0.1-2\cr
##' Date: \tab 2011-10-06\cr    
##' License: \tab GPL-2\cr
##' LazyLoad: \tab yes\cr
##' LazyData: \tab yes\cr
##' }
##' 
##' @author Me \email{my@@email}
##' 
##' Maintainer: Me \email{my@@email}
##'
##' @name kmmisc-package
##' @docType package
##' @title KM Misc
##' @keywords package
##' 
NULL

I'm using R 2.13.2 with roxygen2 2.1 just reinstalled from CRAN. The complete sessionInfo() is in the gist at https://gist.github.com/1268056

Edit

At @andrie's suggestion, I now have

#' Miscellaneous Functions
#' 
#' \tabular{ll}{
#' Package: \tab kmmisc\cr
#' Type: \tab Package\cr
#' Version: \tab 0.1-2\cr
#' Date: \tab 2011-09-14\cr    
#' License: \tab GPL-2\cr
#' LazyLoad: \tab yes\cr
#' LazyData: \tab yes\cr
#' }
#' 
#' @author Me \email{my@@email}
#' 
#' Maintainer: Me \email{my@@email}
#' @name package-kmmisc
#' @docType package
#' @title KM Misc
#' @keywords package
#' @aliases kmmisc package-kmmisc
#'
#' 
NULL

which is still generating the same error.

like image 601
kmm Avatar asked Oct 06 '11 17:10

kmm


2 Answers

I could not replicate the error form the your first code... Are you receiving same error message from roxygenize() to the following simple example?

#' A test function
#'
#' Description
#'
#' Details
#'
#' @param x numeric number
f1 <- function(x) {
  x
}

An additional information:

The code by @Andrie, #' @aliases kmmisc package-kmmisc, has a @aliases problem. In roxygen2 2.1, #' @aliases a-b, which has a hyphen, generates the Rd quoted tag \alias{"a-b"}. In this case the code has no problem, but in other case requires some attention. Of course, if you need quoted tags, you add #' @aliases a-b.

So I think that it's better to replace #' @aliases kmmisc package-kmmisc with #' @aliases kmmisc in this case:

#' Miscellaneous Functions
#'
#' \tabular{ll}{
#' Package: \tab kmmisc\cr
#' Type: \tab Package\cr
#' Version: \tab 0.1-2\cr
#' Date: \tab 2011-09-14\cr
#' License: \tab GPL-2\cr
#' LazyLoad: \tab yes\cr
#' LazyData: \tab yes\cr
#' }
#'
#' @author Me \email{my@@email}
#'
#' Maintainer: Me \email{my@@email}
#' @name package-kmmisc
#' @aliases kmmisc
#' @docType package
#' @title KM Misc
#' @keywords package
NULL
like image 104
Triad sou. Avatar answered Nov 13 '22 13:11

Triad sou.


Try the following:

  • Uncomment your roxygen statements. (This might be a SO artefact, but each roxygen line should start with # ', i.e. a single #)

  • Make the following changes to the documentation

    #' @name package-kmmisc
    #' @aliases kmmisc package-kmmisc

In other words:

  • Change the value of @name
  • Add an alias called kmmisc

These are the only differences between your example and my own package documentation.

like image 35
Andrie Avatar answered Nov 13 '22 14:11

Andrie