parse_epoch_string function

Parse epoch string to the corresponding number of samples it represents.

Parse epoch string to the corresponding number of samples it represents.

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.

Returns

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.

Examples

# 1 min with 80 Hz = 4800 samples parse_epoch_string('1 min', sr=80) # 30 sec with 30 Hz = 900 samples parse_epoch_string('30 sec', sr=30) # 1 hour with 1 Hz = 3600 samples parse_epoch_string('1 hour', sr=1) # 1 day with 10 Hz = 864000 samples parse_epoch_string('1 day', sr=10)

See Also

Other utility functions: clip_data(), cut_off_signal(), interpolate_signal(), sampling_rate(), segment_data(), simulate_new_data()