sort2 | R Documentation |
Sort (or order) a vector or factor (partially) into ascending or descending
order keeping NA
values in place.
sort2(
x,
decreasing = FALSE,
index.return = FALSE,
method = c("auto", "shell", "radix")
)
x |
a numeric, complex, or logical vector |
decreasing |
logical; if |
index.return |
logical; if |
method |
the sorting method used, |
set.seed(1)
x <- sample(10)
x[4:6] <- NA
## compare
sort2(x)
sort(x, na.last = NA)
sort(x, na.last = TRUE)
sort(x, na.last = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.