[R] Require

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Jan 12 19:04:14 CET 2011

On 12.01.2011 18:53, Gene Leynes wrote:
> I think that the "quietly" argument in "require" isn't working
>> require('JumboShrimp', quietly=TRUE)
> Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
> logical.return = TRUE,  :
>    there is no package called 'JumboShrimp'

?require says:
"If TRUE, no message confirming package loading is printed, and most 
often, no errors/warnings are printed if package loading fails."

It does not say that is keeps quiet if the package does not even exist 
on your machine. If you really want to suppress such important warnings, use
  suppressWarnings(require('JumboShrimp', quietly=TRUE))

> By the way, the behavior is the same with options(warn=0) or options(warn=1)

... which I would expect from reading ?options.
You have to use options(warn=-1) to suppress.

Uwe Ligges

> I'm using R 2.12 (2010-10-15) on a windows 7 machine
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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.

More information about the R-help mailing list