[R] Using library in an example
Jim Lemon
jim at bitwrit.com.au
Wed Jun 4 14:09:27 CEST 2008
Hi all,
I've been trying to include a nice example in the Rd file for a function
and cannot work out how to get it through R check. If I use:
if(require(maps,quietly=TRUE)) {
...
Warning message:
'Sys.putenv' is deprecated.
Use 'Sys.setenv' instead.
See help("Deprecated")
The warning message causes R check to get the tremors and assume there
is something wrong with the example. This also means that I can't put a
little message telling the user that they needed "maps" to run the
example, as the warning message leads to the "else" being detached from
the "if" (and another tremor and error message).
I can't really use the following, even though it doesn't cause the
warning (but would be messy if the user didn't have the package).
if(library(maps)) {
...
If I try:
if(library(maps,logical.return=TRUE)) {
...
I get the same warning as with "require". Does this qualify as a bug in
require/library or should I just not bother to test the result of
"library" and let the user suffer?
Jim
More information about the R-help
mailing list