문제

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

해결책

솔루션을 찾았습니다.

MediaController를 MediaPlayer의 실제 인스턴스와 연결하는 대신 인터페이스 방법을 통해 MediaController 위젯을 사용하여 서비스를 연결하는 클래스와 인터페이스 MediaPlayerControl을 구현할 수 있습니다.

다른 팁

Code similar to the one in the question works for me without a problem, and generates the correct documentation. As multiple comments say, the reason must be that I am using the roxygen2 package. So just use roxygen2 and then escape "%" in the documentation using backslash:

#' The percentage sign is written in the documentation like this: \%.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top