```r
# plot the spectral slices
ggplot(sS.dftlong) +
  aes(x = freq, y = track_value,col=labels) +
  geom_line() +
  facet_wrap( ~ sl_rowIdx + labels)
```

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

```r
sS.dftlong = sS.dftlong %>%
  group_by(sl_rowIdx) %>%
  mutate(smoothed = emuR::dct(track_value,m=4,fit=T))

# plot the smoothed slices
ggplot(sS.dftlong) +
  aes(x = freq, y = smoothed,col=labels) +
  geom_line() +
  facet_wrap( ~ sl_rowIdx + labels)
```

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

```r
# or plot original and smoothed slices
ggplot(sS.dftlong) +
  aes(x = freq, y = track_value,col=labels) +
  geom_line() +
  geom_line(aes(y = smoothed),lwd = 1.2) +
  facet_wrap( ~ sl_rowIdx + labels)
```

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