length.bit {bit}R Documentation

Getting and setting length of a bit vector

Description

Query the number of bits in a bit vector or change the number of bits in a bit vector.

Usage

## S3 method for class 'bit':
length(x)
## S3 method for class 'bit':
length(x) <- value

Arguments

x a bit vector
value the new number of bits

Details

Note that no explicit initialization is done. As a consequence, when you first decrease and then increase length you might find that some 'new' bits are already TRUE.

Value

A bit vector with the new length

Author(s)

Jens Oehlschlägel

See Also

bit, length

Examples

  x <- bit(32)
  length(x)
  x[c(1, 32)] <- TRUE
  length(x) <- 16
  x
  length(x) <- 32
  x

[Package bit version 1.0-1 Index]