Description Usage Arguments Value References See Also Examples
This function locates the peaks in a pregenerated periodogram.
Detection is based on pracma::findpeaks.
Only the significant (i.e. power > signif_threshold
) peaks are extracted.
1 | find_peaks(data, n_peaks = 3)
|
data |
behavr::behavr table representing a periodogram, as returned by periodogram |
n_peaks |
maximal numbers of peak to be detected |
behavr::behavr table that is data
with an extra column peak
.
peak
is filled with zeros except for rows match a peak.
In which case, rows have an integer value corresponding to the rank of the peak (e.g. 1 for the first peak).
zeitgebr tutorial – the relevant rehtomics tutorial
periodogram – to generate a periodogram in a first place
ggetho::geom_peak – a layer to show peaks on a periodogram
1 2 3 4 5 6 | data(dams_sample)
# only four ndividuals for the sake of the example
dt <- dams_sample[xmv(region_id) %in% c(1, 7, 21, 31)]
per_dt_xs <- periodogram(activity, dt, FUN = chi_sq_periodogram)
per_dt_xs_with_peaks <- find_peaks(per_dt_xs)
per_dt_xs_with_peaks[peak == 1]
|
Loading required package: behavr
Loading required package: data.table
==== METADATA ====
id file_info region_id
<fctr> <list> <int>
1: 2017-01-16 08:00:00|dams_sample.txt|01 <list[2]> 1
2: 2017-01-16 08:00:00|dams_sample.txt|07 <list[2]> 7
3: 2017-01-16 08:00:00|dams_sample.txt|21 <list[2]> 21
4: 2017-01-16 08:00:00|dams_sample.txt|31 <list[2]> 31
experiment_id start_datetime stop_datetime
<char> <POSc> <fctr>
1: 2017-01-16 08:00:00|dams_sample.txt 2017-01-16 08:00:00 2017-01-26 00:09:00
2: 2017-01-16 08:00:00|dams_sample.txt 2017-01-16 08:00:00 2017-01-26 00:09:00
3: 2017-01-16 08:00:00|dams_sample.txt 2017-01-16 08:00:00 2017-01-26 00:09:00
4: 2017-01-16 08:00:00|dams_sample.txt 2017-01-16 08:00:00 2017-01-26 00:09:00
period_group
<fctr>
1: long
2: long
3: short
4: wt
====== DATA ======
id period power signif_threshold
<fctr> <num> <num> <num>
1: 2017-01-16 08:00:00|dams_sample.txt|01 99720 276.4555 177.4971
2: 2017-01-16 08:00:00|dams_sample.txt|07 98640 200.8368 176.2397
3: 2017-01-16 08:00:00|dams_sample.txt|21 68040 170.8709 132.6670
4: 2017-01-16 08:00:00|dams_sample.txt|31 86040 294.5654 158.5068
p_value peak
<num> <int>
1: 4.100760e-16 1
2: 2.809713e-07 1
3: 2.936584e-09 1
4: 4.913109e-22 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.