These methods are packaged here for methods in packages bit64
and ff
.
Usage
# S3 method for class 'integer64'
na.count(x, ...)
# S3 method for class 'integer64'
nvalid(x, ...)
# S3 method for class 'integer64'
is.sorted(x, ...)
# S3 method for class 'integer64'
nunique(x, ...)
# S3 method for class 'integer64'
nties(x, ...)
Details
All these functions benefit from a sortcache()
, ordercache()
or
sortordercache()
. na.count()
, nvalid()
and nunique()
also
benefit from a hashcache()
.
Functions
na.count(integer64)
: returns the number ofNA
snvalid(integer64)
: returns the number of valid data points, usuallylength()
minusna.count
.is.sorted(integer64)
: checks for sortedness ofx
(NAs sorted first)nunique(integer64)
: returns the number of unique valuesnties(integer64)
: returns the number of tied values.
Note
If a cache()
exists but the desired value is not cached, then these
functions will store their result in the cache. We do not consider this
a relevant side-effect, since these small cache results do not have a
relevant memory footprint.
See also
cache()
for caching functions and sortordercache()
for functions creating big caches
Examples
x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
length(x)
#> [1] 32
bit::na.count(x)
#> Warning: Detected that 'na.count.integer64' was called directly. Instead only call 'na.count' and rely on S3 dispatch. To suppress this warning, e.g. if this is a false positive, use options(bit64.warn.exported.s3.method = FALSE). In the next version, this symbol will stop being exported.
#> [1] 16
bit::nvalid(x)
#> Warning: Detected that 'nvalid.integer64' was called directly. Instead only call 'nvalid' and rely on S3 dispatch. To suppress this warning, e.g. if this is a false positive, use options(bit64.warn.exported.s3.method = FALSE). In the next version, this symbol will stop being exported.
#> [1] 16
bit::nunique(x)
#> Warning: Detected that 'nunique.integer64' was called directly. Instead only call 'nunique' and rely on S3 dispatch. To suppress this warning, e.g. if this is a false positive, use options(bit64.warn.exported.s3.method = FALSE). In the next version, this symbol will stop being exported.
#> [1] 9
bit::nties(x)
#> Warning: Detected that 'nties.integer64' was called directly. Instead only call 'nties' and rely on S3 dispatch. To suppress this warning, e.g. if this is a false positive, use options(bit64.warn.exported.s3.method = FALSE). In the next version, this symbol will stop being exported.
#> [1] 30
table.integer64(x)
#> Warning: Detected that 'table.integer64' was called directly. Instead only call 'table' and rely on S3 dispatch. To suppress this warning, e.g. if this is a false positive, use options(bit64.warn.exported.s3.method = FALSE). In the next version, this symbol will stop being exported.
#> x
#> <NA> 1 2 3 4 5 7 8 9
#> 16 4 2 1 1 2 2 2 2
x
#> integer64
#> [1] <NA> 5 <NA> <NA> <NA> <NA> 1 <NA> <NA> <NA> 2 3 1
#> [14] 9 2 8 8 <NA> <NA> 7 1 7 <NA> 5 4 <NA>
#> [27] 1 <NA> <NA> <NA> <NA> 9