[Roxygen-devel] How to escape % in roxygen literate programming?

Karsten Weinert k.weinert at gmx.net
Fri Apr 2 20:53:46 CEST 2010


Hello,

the default value of a parameter of my function contains a "%". This
seems to be a problem for roxygen, it produces a lot of warnings and R
CMD check fails when trying to build latex documentation.

How can I make this function (and its documentation) work? Using %% or
\% instead of % does not help.

    #' Test escape \% from in-source documentation (roxygen).
    #'
    #' What happens when parameters contain special latex characters?
    #'
    #' @param x unsuspicious parameter
    #' @param format sprintf format string (default "\%5.0f")
    #'
    #' @return formatted string
    #' @export
    #' @author Karsten Weinert
    testroxy <- function(x, format = "%5.0f") {
      sprintf(format,x)
    }

Any hint appreciated,
kind regards,

Karsten


More information about the Roxygen-devel mailing list