> On 27 Feb 2015, at 16:02 , Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > > Yes. Indexing with a logical NA is probably a mistake, and this is one > way to signal it without actually triggering a warning or error.
There are cases where it isn't (usually) a mistake, e.g. pch=c(25,24)[sex], where it is quite crucial that the result has the same length as the index (i.e., sex) and where it makes good sense to use an NA plotting character if sex is unknown. For logical index, it is harder to come up with a good excuse for the NA behaviour, except that R's NA is by default logical so there would be trouble explaining differences between c(x[NA], x[1]) and x[c(NA, 1)]. (The annoyance of getting a data frame half-full of NA was the reason that subset() was written so that it removes rows corresponding to NA indices). -pd -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.