There was a reason for that line, as running 'make check' with your
modification would have shown you. Sometimes naresid() is called with
x=NULL. AFAICS replacing the test with is.null(x) suffices, and I'm
testing that in R-devel. If nothing else comes up I will port it to
R-patched later.
x <- NA
na.act <- na.action(na.exclude(x))
y <- rep(0,0)
naresid(na.act,y)
... currently produces the result...
numeric(0)
... whereas the documentation might lead you to expect
NA
The behaviour is caused by the line
if (length(x) == 0L) return(x)
in `stats:::naresid.exclude'. Re