encode: Encode

View source: R/coded-vec.R

encodeR Documentation

Encode

Description

Transforms a given object into an integer-based encoding.

Usage

encode(x)

encode_pc_set(x)

encode_pc_chord_type(x)

encode_pc_chord(x)

## S3 method for class 'vec'
encode(x)

## S3 method for class 'coded_vec'
encode(x)

## S3 method for class 'corpus'
encode(x)

decode.corpus(x)

## S3 method for class 'pc_chord_type'
encode(x)

## S3 method for class 'pc_chord'
encode(x)

## S3 method for class 'pc_set_type'
encode(x)

## S3 method for class 'pc_set'
encode(x)

Arguments

x

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

Details

Encoding is currently defined for the following types:

  • pc_set

  • pc_set_type

  • pc_chord

  • pc_chord_type

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

Value

Encoded object.

See Also

decode for the reverse operation.


pmcharrison/hrep documentation built on Feb. 18, 2024, 2:33 a.m.