unique_tagged_na {labelled} | R Documentation |
Unique elements, duplicated, ordering and sorting with tagged NAs
Description
These adaptations of base::unique()
, base::duplicated()
,
base::order()
and base::sort()
treats tagged NAs as distinct
values.
Usage
unique_tagged_na(x, fromLast = FALSE)
duplicated_tagged_na(x, fromLast = FALSE)
order_tagged_na(
x,
na.last = TRUE,
decreasing = FALSE,
method = c("auto", "shell", "radix"),
na_decreasing = decreasing,
untagged_na_last = TRUE
)
sort_tagged_na(
x,
decreasing = FALSE,
na.last = TRUE,
na_decreasing = decreasing,
untagged_na_last = TRUE
)
Arguments
x |
a vector |
fromLast |
logical indicating if duplication should be considered from the last |
na.last |
if |
decreasing |
should the sort order be increasing or decreasing? |
method |
the method to be used, see |
na_decreasing |
should the sort order for tagged NAs value be |
untagged_na_last |
should untagged |
Examples
x <- c(1, 2, tagged_na("a"), 1, tagged_na("z"), 2, tagged_na("a"), NA)
x %>% print_tagged_na()
unique(x) %>% print_tagged_na()
unique_tagged_na(x) %>% print_tagged_na()
duplicated(x)
duplicated_tagged_na(x)
order(x)
order_tagged_na(x)
sort(x, na.last = TRUE) %>% print_tagged_na()
sort_tagged_na(x) %>% print_tagged_na()
[Package labelled version 2.13.0 Index]