views:

51

answers:

0

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