[R] Using library in an example

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Wed, 04 Jun 2008 22:09:27 +1000

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?


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 04 Jun 2008 - 12:43:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 14:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive