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'. Removing this line results in the behaviour I'd expected in the above example (and in a test example where `x' is a zero row matrix). Is the coded behaviour necessary for some reason? Could it be changed (so that my example produces NA)? The reason I ask is that I use `napredict' in mgcv:predict.gam, and someone complained that if he predicts using newdata that is all NA, then he doesn't get what he expected (he has a pretty good reason for doing this). Part of the problem with predict.gam in this case was my code, but once I fixed that I ran up against the above problem. Actually, I just checked the source code and the line of naresid.exclude that causes the problem already has this comment after it.... # << FIXME? -- reconstructing all NA object ... so I guess I'm really asking if there is any chance of fixing this soon, or whether I should just code up a work-around for predict.gam? Simon -- > Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK > +44 1225 386603 www.maths.bath.ac.uk/~sw283 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel