Re: [R] Using library in an example

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Wed, 04 Jun 2008 08:37:59 -0400

On 6/4/2008 8:09 AM, Jim Lemon wrote:
> 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")

require() doesn't use Sys.putenv, so I'd guess some package that you're loading does. However, the current version of maps doesn't, so I think you must be loading something that's obsolete.

sessionInfo() would have helped a lot.

Duncan Murdoch

>
> 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
>
> ______________________________________________
> 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.



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 - 13:24:26 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 - 13:30:37 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