I read the help first, and read it again now, but I still don't see why the
warning was generated.

The help seems to state clearly that the user can suppress warnings
    "most often, no errors/warnings are printed if package loading fails."

If the package doesn't exist, then it would fail to load, right?  When that
failure happens, I thought I could suppress the warning message with the
quietly argument.

Thank you for pointing out the suppressWarnings function, that one is new to
me, and I suppose it will work here.  However it seems that it shouldn't be
necessary with quietly=TRUE.

By the way, I wanted to suppress the confusing message generated by R, and
put in a simple recommendation that the user should try installing the
package.


2011/1/12 Uwe Ligges <lig...@statistik.tu-dortmund.de>

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

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to