vf <- function(x){
o <- outer(x, x)
as.vector(na.omit(o[lower.tri(o)]))
}
vf(1:5)
vf(c(1,2,NA,4,5))
Best,
Uwe Ligges
On 20.06.2023 19:13, Philip Rhoades via R-help wrote:
People,
What I mean is, is there an elegant way to do this:
This:
!(1,2,3,4,5)
would give this:
(2,3,4,5, 6,8,10, 12,15, 20)
and this:
!(1,2,NA,4,5)
would give this:
(2,4,5, 8,10, 20)
?
Thanks!
Phil.
______________________________________________
[email protected] 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.