[R] How to manage an error message about NA/NaN/Inf

Moohwan Kim kmhlmj2 at gmail.com
Sun May 16 01:51:22 CEST 2010


Dear R Family,

I have an error message. I would like to learn how to deal with that.
The orginal series is as follows: I just pick up the first 10 observations.
> dif_transaud[1:10]
 [1]  0.0065880493 -0.0065880490 -0.0131743570  0.0197745715  0.0065889175
 [6]  0.0131813110  0.0065923924 -0.0395587070  0.0000156455  0.0197693578

Then I transformed them into the following observations.
> dif_transaud_sq <- dif_transaud^2
> lnabsdif_transaud <- 0.5*log(dif_transaud_sq)
> lnabsdif_transaud[1:10]
 [1]  -5.022498  -5.022498  -4.329483  -3.923358  -5.022366  -4.328955
 [7]  -5.021839  -3.229969 -11.065327  -3.923622

Finally, I run the program, which is part of wavelet transform.
> mra.out <- mra(lnabsdif_transaud, filter="la8", n.levels=8,
+       boundary="reflection", fast=TRUE, method="modwt")

However, this triggered an error message.
> Error in FUN(1L[[1L]], ...) : NA/NaN/Inf in foreign function call (arg 1)

I guess there are a few big negative numbers in lnabsdif_transaud.
I was wondering if there is an appropriate way to truncate those
numbers in a reasonable way.

Regards,
Moohwan Kim



More information about the R-help mailing list