Skip to content

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, ...)

Arguments

x

some object

...

ignored

Value

is.sorted returns a logical scalar, the other methods return an integer scalar.

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 of NAs

  • nvalid(integer64): returns the number of valid data points, usually length() minus na.count.

  • is.sorted(integer64): checks for sortedness of x (NAs sorted first)

  • nunique(integer64): returns the number of unique values

  • nties(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)
#> [1] 14
 bit::nvalid(x)
#> [1] 18
 bit::nunique(x)
#> [1] 8
 bit::nties(x)
#> [1] 31
 table(x)
#> x
#> 1 3 4 5 6 7 8 
#> 1 5 3 2 3 2 2 
 x
#> integer64
#>  [1] 3    8    3    <NA> <NA> <NA> 4    <NA> 1    6    3    <NA> 3   
#> [14] 6    7    4    <NA> <NA> 4    <NA> 5    8    <NA> <NA> <NA> <NA>
#> [27] 3    <NA> 6    <NA> 5    7