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)

Arguments

epoch_str

string. The input epoch str as accepted by breaks argument of cut.POSIXt.

sr

number. The sampling rate in Hz used to parse the epoch string.

Value

number. The number of samples represented by the epoch string.

Details

This function parses the given epoch string (e.g. "5 secs") and outputs the corresponding number of samples represented by the epoch string.

How is it used in MIMS-unit algorithm?

This function is used in aggregate_for_mims function and mims_unit function.

See also

Examples

# 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