[R] try question

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Tue Jul 29 19:07:32 CEST 2008


> > 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?
The 'silent' argument to try supresses errors, not warnings.  You can 
convert warnings to errors with options(warn=2), or ignore warnings with 
options(warn=-1).  See ?options for more details.

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list