[Rd] On base::rank
Arunkumar Srinivasan
arunkumar.sriniv at gmail.com
Thu Jan 8 13:46:57 CET 2015
Have a look at the following, taken from base::rank:
...
if (!is.na(na.last) && any(nas)) {
yy <- integer(length(x)) # <~~~~~~~~~
storage.mode(yy) <- storage.mode(y) # <~~~~~~~~
yy <- NA
NAkeep <- (na.last == "keep")
if (NAkeep || na.last) {
yy[!nas] <- y
if (!NAkeep)
yy[nas] <- (length(y) + 1L):length(yy)
}
...
Alternatively, look at lines 36 and 37 here:
https://github.com/wch/r-source/blob/fbf5cdf29d923395b537a9893f46af1aa75e38f3/src/library/base/R/rank.R#L36
There seems to be no need for those lines, IIUC. Isn't it? 'yy' is
replaced with NA in the ver next line.
Best,
Arun.
More information about the R-devel
mailing list