```r
#repetition: take the mean of the energy in a certain range:
sS2to3thousandHz = sS.dftlong%>%
  filter(freq>=2000 & freq <=3000)%>%
  group_by(labels,sl_rowIdx)%>%
  summarise(amplitudes_2000_3000Hz = mean(track_value))

a = ggplot(sS2to3thousandHz)+
  aes(x=labels,y=amplitudes_2000_3000Hz,col=labels)+
  geom_boxplot()

# or calculate k0 in the same frequency range:
sS.dctCoefficients2to3thousandHz =
  sS.dftlong %>%
  filter(freq>=2000 & freq <=3000)%>%
  group_by(labels,sl_rowIdx) %>%
  do(data_frame(DCT = emuR::dct(.$track_value,m=5,fit=F))) %>%
  mutate(DCTCOEF = paste0("k",0:(table(sl_rowIdx)-1))) %>%
  tidyr::spread(DCTCOEF, DCT)

b = ggplot(sS.dctCoefficients2to3thousandHz)+
  aes(x=labels,y=k0,col=labels)+
  geom_boxplot()

grid.arrange(a,b,ncol=2)
```

<img src="SpectralAnalysis_files/figure-html/unnamed-chunk-25-1.png" width="960" style="display: block; margin: auto;" />