bit_unidup | R Documentation |
Fast versions of unique()
, duplicated()
,
anyDuplicated()
and sum(duplicated(x))
for integers.
bit_unique(x, na.rm = NA, range_na = NULL)
bit_duplicated(x, na.rm = NA, range_na = NULL, retFUN = as.bit)
bit_anyDuplicated(x, na.rm = NA, range_na = NULL)
bit_sumDuplicated(x, na.rm = NA, range_na = NULL)
x |
an integer vector |
na.rm |
|
range_na |
|
retFUN |
a function that coerces |
determines the range of the integers and checks if the density justifies use
of a bit vector; if yes, uses a bit vector for finding duplicates; if no,
falls back to unique()
, duplicated()
, anyDuplicated()
and sum(duplicated(x))
bit_unique
returns a vector of unique integers,
bit_duplicated
returns a boolean vector coerced to retFUN
,
bit_anyDuplicated
returns the position of the first duplicate (or zero if no
duplicates)
bit_sumDuplicated
returns the number of duplicated values (as.integer)
bit_unique()
: extracts unique elements
bit_duplicated()
: determines duplicate elements
bit_anyDuplicated()
: checks for existence of duplicate elements
bit_sumDuplicated()
: counts duplicate elements
bit_sort_unique()
bit_unique(c(2L, 1L, NA, NA, 1L, 2L))
bit_unique(c(2L, 1L, NA, NA, 1L, 2L), na.rm=FALSE)
bit_unique(c(2L, 1L, NA, NA, 1L, 2L), na.rm=TRUE)
bit_duplicated(c(2L, 1L, NA, NA, 1L, 2L))
bit_duplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=FALSE)
bit_duplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=TRUE)
bit_anyDuplicated(c(2L, 1L, NA, NA, 1L, 2L))
bit_anyDuplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=FALSE)
bit_anyDuplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=TRUE)
bit_sumDuplicated(c(2L, 1L, NA, NA, 1L, 2L))
bit_sumDuplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=FALSE)
bit_sumDuplicated(c(2L, 1L, NA, NA, 1L, 2L), na.rm=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.