Hi,

you are unfortunately right. Executing

x <- sample(c(1,2,NA), 26, replace=TRUE)
y <- sample(c(1,2,NA), 26, replace=TRUE)
o <- order(x, y, decreasing = c(T,F), na.last=c(F,T))
cbind(x[o], y[o])

shows that the second entry of na.last is ignored without warning.

Thanks Sigbert

Am 10.04.24 um 10:29 schrieb Ivan Krylov:
В Wed, 10 Apr 2024 09:33:19 +0200
Sigbert Klinke <sigb...@wiwi.hu-berlin.de> пишет:

decreasing=c(F,F,F)

This is only documented to work with method = 'radix':

For the ‘"radix"’ method, this can be a vector of length equal to
the number of arguments in ‘...’ and the elements are recycled as
necessary.  For the other methods, it must be length one.

na.last=c(T,T,T),

I think this is supposed to be a scalar, no matter the sort method. At
the very least, I don't see it documented to accept a logical vector,
and the C code in both src/main/sort.c and src/main/radixsort.c treats
the argument as a scalar (using asLogical(...), not LOGICAL(...) on the
R value).


--
https://hu.berlin/sk
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar

______________________________________________
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.

Reply via email to