Unexpected section header '\ examples' when checking package R

When I use R CMD, check pkg_name to check my own R package, I get warnings like this:

unexpected section header '\examples' unexpected section header '\keyword' 

The problem exists in the .Rd file, where I write some examples of R-codes for my own data (i.e. the .Rd file is for the .RDdata file, and not for the .R function file). I thought we could just write code examples ("...") between {} below:

 \example{ ... } 

Unfortunately, he cannot go through the packet inspection procedure ... Thank you in advance for your help!

+8
r package
source share
3 answers

There is a mismatch {} in the .Rd file, which causes the problem. This is very difficult to detect, make sure you have paired pairs before doing the R CMD check pkg_name.

+3
source share

I once experienced this problem when using the percent sign ( % ). I tried to write documentation for the confidence interval parameter. Then I realized that I needed to escape the backslash character to fix the error (as in LaTeX). So I replaced % with \% . This fixed the bug.

+21
source share

This error message may get more hits now that roxygen2 (mercifully) supports markdowns . If you convert from an old file in LaTeX style, some LaTeX-legal syntax may still be hidden from manual conversion.

Converting from the word β€œword” to β€œword” resolved my parsing error Rd (that is, changed the leading back side to a normal quote).

0
source share

All Articles