Truncate the Base Segment of a Melatonin Profile
Source:R/truncate_base_segment.R
truncate_base_segment.RdThis function identifies and removes points in the base segment where melatonin concentrations exceed a specified threshold. It ensures that only the earliest base points remain while maintaining a valid base segment structure.
Arguments
- profile_data
A tibble or dataframe containing the melatonin profile. It must include the columns:
datetime(POSIXct) – Timestamps of data points.melatonin(numeric) – Melatonin concentration levels.base(integer, 0 or 1) – Indicator of base segment points.
- threshold
Numeric. The melatonin concentration threshold. Any base segment points above this threshold are removed. Default is
2.3.