Transforms a given object into an integer-based encoding.

encode(x)

encode_pc_set(x)

encode_pc_chord_type(x)

encode_pc_chord(x)

# S3 method for vec
encode(x)

# S3 method for coded_vec
encode(x)

# S3 method for corpus
encode(x)

# S3 method for pc_chord_type
encode(x)

# S3 method for pc_chord
encode(x)

# S3 method for pc_set_type
encode(x)

# S3 method for pc_set
encode(x)

Arguments

x

Object to encode, as created by pc_set, pc_set_type, pc_chord, or pc_chord_type.

Value

Encoded object.

Details

Encoding is currently defined for the following types:

An error will be thrown when trying to encode objects of other types.

The encode function is vectorised and uses precomputed encodings. The following functions represent alternative implementations that are not vectorised and do not rely on precomputed encodings. Note that these alternative implementations do not necessarily perform systematic input checking.

  • encode_pc_set

  • encode_pc_chord_type

  • encode_pc_chord

See also

decode for the reverse operation.