[R] To correct an error message

David Winsemius dwinsemius at comcast.net
Mon May 17 15:17:11 CEST 2010


On May 17, 2010, at 8:22 AM, Moohwan Kim wrote:

> 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.
>> [1:10]
> [1]  0.0065880493 -0.0065880490 -0.0131743570  0.0197745715   
> 0.0065889175
> [6]  0.0131813110  0.0065923924 -0.0395587070  0.0000156455   
> 0.0197693578

summary(dif_transaud) would have been a more complete assessment.
>
>
> 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.

What does dif_transaud[is.na(dif_transaud)] show?

> I was wondering if there is an appropriate way to truncate those
> numbers in a reasonable way.

Not sure about what you mean by "truncate". The which() function  
should work with is.na() to tell you the locations of the NA values:
 > x <- c(1:5, NA, 6:10)
 > which(is.na(x))
[1] 6

>
> Regards,
> Moohwan Kim
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list