[R] Strange behavior of is.na() on lists

Duncan Murdoch murdoch at stats.uwo.ca
Sat Sep 25 19:33:40 CEST 2004


On Sat, 25 Sep 2004 18:26:11 +0200, Adrian Alexa
<adrian.alexa at gmail.com> wrote:

>Hello R-users, 
>
>
>I have observed that is.na() behaves strange on some lists. Here is a
>simple example:
>
>
>> a = list(list('asd'))
>> a
>[[1]]
>[[1]][[1]]
>[1] "asd"
>
>
>> for(i in 1:5)
>+ print(is.na(a))
>[1] TRUE
>[1] FALSE
>[1] TRUE
>[1] TRUE
>[1] TRUE

Yes, this is a bug.  The problem is that the code leaves the result
unset in this case (no default on an incomplete switch statement).
I'll fix it.

Thanks for the report!

Duncan Murdoch




More information about the R-help mailing list