Summarises vector-based features in nested list columns.

compmus_summarise(dat, feature, method = "mean", norm = "id", na.rm = FALSE)

compmus_summarize(dat, feature, method = "mean", norm = "id", na.rm = FALSE)

Arguments

dat

A tibble containing list columns.

feature

The vector-valued column of dat to summarise (unquoted).

method

A character string indicating which summarisation method to use (see Details). Default is the arithmetic mean.

norm

An optional character string indicating the method for pre-normalising each vector with compmus_normalise.

na.rm

Remove NA values?

Details

The following methods are supported.

Functions

  • compmus_summarize: Summarize possibly vector-valued columns

Central Tendency

mean

arithmetic mean

aitchison,acentre,acenter

Aitchison centre

rms

root mean square

max

maximum

Dispersion

sd

standard deviation

asd

standard deviation of clr-transformed components

sdsq

standard deviation of squares

varration

variation ratio

Examples

library(tidyverse)
get_tidy_audio_analysis("5ZLkc5RY1NM4FtGWEd6HOE") %>%
  compmus_align(bars, segments) %>%
  select(bars) %>%
  unnest(bars) %>%
  mutate(
    pitches =
      map(
        segments,
        compmus_summarise, pitches,
        method = "rms", norm = "euclidean"
      )
  )
#> # A tibble: 67 × 5
#>     start duration confidence segments          pitches   
#>     <dbl>    <dbl>      <dbl> <list>            <list>    
#>  1  0.468     3.61      0.237 <tibble [11 × 9]> <dbl [12]>
#>  2  4.08      3.52      0.349 <tibble [9 × 9]>  <dbl [12]>
#>  3  7.60      3.53      0.73  <tibble [10 × 9]> <dbl [12]>
#>  4 11.1       3.52      0.785 <tibble [11 × 9]> <dbl [12]>
#>  5 14.7       3.52      0.675 <tibble [11 × 9]> <dbl [12]>
#>  6 18.2       3.53      0.588 <tibble [12 × 9]> <dbl [12]>
#>  7 21.7       3.53      0.503 <tibble [9 × 9]>  <dbl [12]>
#>  8 25.2       3.54      0.916 <tibble [13 × 9]> <dbl [12]>
#>  9 28.8       3.53      0.335 <tibble [12 × 9]> <dbl [12]>
#> 10 32.3       3.53      0.598 <tibble [13 × 9]> <dbl [12]>
#> # … with 57 more rows