[R] \examples{} in Rd file

Peter Ehlers ehlers at ucalgary.ca
Sun Jan 16 12:46:12 CET 2011


Adelchi,

Since % is the LaTeX comment character, you may want to
try escaping it.

Peter Ehlers

On 2011-01-16 02:35, Adelchi Azzalini wrote:
> [Hope this is the right list where to send...]
>
> An attempt to update package 'mnormt' involves the addition of a
> small new function called 'pd.solve'.  When I come to the package
> checking stage, an error occurs in parsing  pd.solve.Rd.
> The full transcript of the outcome is copied below (it includes details
> on my installation) but the critical point is where the \examples{}
> section includes a %*%. The relevant portion of the source file is
>
> \examples{
>     x<- toeplitz(rev(1:4))
>     x.inv<- pd.solve(x)
>     print(x.inv %*% x)
>     logDet<- attr(x.inv, "log.det")
>     print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
> }
>
> which leads to the message
>
>    ### ** Examples
>   >
>   >    x<- toeplitz(rev(1:4))
>   >    x.inv<- pd.solve(x)
>   >    print(x.inv
> +   logDet<- attr(x.inv, "log.det")
> Error: unexpected symbol in:
> "  print(x.inv
>     logDet"
>
> When I install the package, it works, except that the documentation
> portion looks like:
>
> Examples
> x<- toeplitz(rev(1:4))
> x.inv<- pd.solve(x)
> print(x.inv
> logDet<- attr(x.inv, "log.det")
> print(abs(logDet - determinant(x, logarithm=TRUE)$modulus))
>
> It seems that the examples are parsed as ordinary text, not R commands.
> I am really puzzled. Any explanation?
>
> Adelchi Azzalini
>
[... snip ...]



More information about the R-help mailing list