[R] \examples{} in Rd file
Adelchi Azzalini
azzalini at stat.unipd.it
Sun Jan 16 11:35:30 CET 2011
[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
----
[mac:aa:~/SW/R/Pkg-mnormt] R CMD Check mnormt
running .Rprofile
(Sun 16-Jan-2011, 11:17:59)
* using log directory ‘/Users/aa/SW/R/Pkg-mnormt/mnormt.Rcheck’
* using R version 2.12.1 (2010-12-16)
* using platform: i386-apple-darwin9.8.0 (32-bit)
* using session charset: UTF-8
* checking for file ‘mnormt/DESCRIPTION’ ... OK
* this is package ‘mnormt’ version ‘1.4-0’
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package ‘mnormt’ can be installed ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch ‘i386’
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated
dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
* loading checks for arch ‘ppc’
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated
dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
* loading checks for arch ‘x86_64’
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated
dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
* checking for unstated dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... NOTE
Error: parse error in file 'mnormt-Ex.R':
3: unexpected symbol
89: print(x.inv
90: logDet
^
Execution halted
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking for portable use of $BLAS_LIBS ... OK
* checking examples ...
** running examples for arch ‘i386’ ... ERROR
Running examples in ‘mnormt-Ex.R’ failed
The error most likely occurred in:
> ### Name: pd.solve
> ### Title: Inverse of a positive definite matrix
> ### Aliases: pd.solve
> ### Keywords: algebra array
>
> ### ** 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"
Execution halted
More information about the R-help
mailing list