R/helper.R
parse_epoch_string.Rd
parse_epoch_string
parses the epoch string (e.g. "1 min"), and outputs
the corresponding number of samples it represents.
parse_epoch_string(epoch_str, sr)
string. The input epoch str as accepted by breaks
argument of cut.POSIXt
.
number. The sampling rate in Hz used to parse the epoch string.
number. The number of samples represented by the epoch string.
This function parses the given epoch string (e.g. "5 secs") and outputs the corresponding number of samples represented by the epoch string.
This function is used in
aggregate_for_mims
function and mims_unit
function.
Other utility functions:
clip_data()
,
cut_off_signal()
,
interpolate_signal()
,
sampling_rate()
,
segment_data()
,
simulate_new_data()
# 1 min with 80 Hz = 4800 samples
parse_epoch_string('1 min', sr=80)
#> [1] 4800
# 30 sec with 30 Hz = 900 samples
parse_epoch_string('30 sec', sr=30)
#> [1] 900
# 1 hour with 1 Hz = 3600 samples
parse_epoch_string('1 hour', sr=1)
#> [1] 3600
# 1 day with 10 Hz = 864000 samples
parse_epoch_string('1 day', sr=10)
#> [1] 864000