Bug 16107 - is.na throws warning for NULL
Summary: is.na throws warning for NULL
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.1.2
Hardware: All All
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-12-13 17:36 UTC by Ryan Grannell1
Modified: 2014-12-13 17:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Grannell1 2014-12-13 17:36:04 UTC
is.na works returns logical(0) for empty lists and empty typed vectors, as you would expect, but it throws also a warning for NULL values, stating it is a non-vector type. NULL is the empty pairlist, so it seems it should just return logical(0) without the warning.

> is.na(NULL)
logical(0)
Warning message:
In is.na(NULL) : is.na() applied to non-(list or vector) of type 'NULL'
> 

I know pairlists are deprecated from external use, but this behaviour is a bit inconsistant given that is.na works foine for non-empty pairlists. I would imagine it should either throw an error for both examples, or neither.

> is.na(pairlist(1, 2))
[1] FALSE FALSE