corpus_dissonance_table: Corpus dissonance table

Description Usage Arguments Value

View source: R/corpus-dissonance-table.R

Description

Derives sufficient information from a corpus to formulate a corpus-based dissonance model.

Usage

1
2
3
4
5
corpus_dissonance_table(x, type = "pc_chord_type", add = 1L)

## S3 method for class 'corpus'
corpus_dissonance_table(x, type = "pc_chord_type",
  add = 1L)

Arguments

x

Corpus to analyse, as created by hrep::corpus.

type

(Scalar character) Representation to which chords should be coerced before counting.

add

(Scalar numeric) Number to add to each count before computing probabilities. This is useful for ensuring that chord probabilities exceed zero.

Value

Returns an object of class corpus_dissonance_table, a tibble where each row corresponds to a different pitch-class chord type (i.e. an object of class pc_chord_type), with the mapping between integer indices and chord types defined by the hrep package. This tibble contains the following columns:

count

The number of times the chord type was observed in the corpus.

prob

The inferred probability of that chord type.

log_prob

The inferred log probability of that chord type.


pmcharrison/corpdiss documentation built on Sept. 21, 2019, 12:07 a.m.