Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Verbatim output in roxygen2 package documentation

I am using roxygen2 from within RStudio to generate package documentation. How do I force the following in the @description section to appear as verbatim fixed-font?

SettingID    Value    
RedItem      Patient_10574    
GreenItem    Record_433    

My workaround is to put it into @examples \dontrun{}, but that's not what I want.

@Joshua Ulrich found a (non-)solution to here

like image 318
Dieter Menne Avatar asked Jun 12 '13 08:06

Dieter Menne


People also ask

What is .RD file in R?

R objects are documented in files written in “R documentation” (Rd) format, a simple markup language much of which closely resembles (La)TeX, which can be processed into a variety of formats, including LaTeX, HTML and plain text.

What is Roxygen?

roxygen2 allows you to write specially formatted R comments that generate R documentation files ( man/*. Rd ) and a NAMESPACE file. roxygen2 is used by over 8,000 CRAN packages. Install the latest version of roxygen2 with: install.packages("roxygen2")


1 Answers

UPDATE: Wrapping is now turned off by default in roxygen2, so this should not be an issue anymore.

I have invented a new comment syntax for roxygen2 that will preserve wrapping: Comments starting with

#''

are not wrapped at all. My reference implementation hasn't received much attention yet, though...

Of course, turning off wrapping altogether is also a way to handle the problem, but I wonder how the help looks like in a command-line terminal if the developer forgets to wrap her roxygen comments... There must have been a reason why wrapping was introduced in the first place.

like image 81
krlmlr Avatar answered Sep 20 '22 19:09

krlmlr