[R] Try for to use in read.pnm()

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Feb 2 11:59:03 CET 2003

Francisco do Nascimento Junior wrote:
> Hi,
> I don't obtain to use try to capture an error of read.pnm().
> I was using:
> res <- try(read.pnm(file_name))
> But I don't understand that the variable res represents, 

?try tells us:
"The value of the expression if expr is evaluated without error, but an
invisible object of class "try-error" containing the error message if it
if fails."

[R-Core: One "if" too much at the end of that sentence]

> or eiher, as I can access its attrbites.

See ?attributes and ?attr
There is only one attribute, class = "try-error", if expr fails...

> Tks,
> Francisco.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Francisco Júnior,
> Computer Science - UFPE-Brazil
> "One life has more value that the
> world whole"
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Uwe Ligges

More information about the R-help mailing list