[R] try question
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jul 29 19:19:57 CEST 2008
On Tue, 29 Jul 2008, Edna Bell wrote:
> Hi still yet again!
>
> I have the following code:
>
>> try(log(rnorm(25)),silent=TRUE)
> [1] -0.26396185 NaN NaN -0.13078069 -2.44997193
> -2.15603971 NaN 0.94917495 0.07244544 NaN
> [11] -1.06341127 -0.42293099 -0.53769569 0.95134763 0.93403340
> NaN -0.10502078 NaN 0.30283262 NaN
> [21] -0.11696872 -3.84122332 NaN NaN -0.12808690
> Warning message:
> In log(rnorm(25)) : NaNs produced
>>
>
> I thought that putting the "silent = TRUE" would suppress the
> warnings, please. What should I do instead, please?
No, it supresses the error message (and you have no error here). Use
suppressWarnings().
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list