This function extracts the sleep cycle data for a specific subject from a grouped SleepCycle object.
Usage
get_id(sleepcycle_obj, .id)
Arguments
- sleepcycle_obj
An object of class "SleepCycle" that contains multiple IDs.
- .id
The subject ID to extract from sleepcycle_obj. Must be present in the grouped dataset.
Value
A new "SleepCycle" object containing data only for the selected subject, including:
epoch: Per-epoch sleep stage and cycle classifications.
summary: Sleep cycle summaries for the extracted subject.
info: Metadata about the SleepCycle object.
Details
This function is used to extract a single subject's sleep cycle data from a multi-subject dataset.
If the provided sleepcycle_obj is not grouped, the function stops execution to prevent unnecessary extraction.