sleepStat {phase} | R Documentation |
Computes and tabulates day-time and night-time sleep statistics
Description
This function allows users to estimate day-time and night-time average sleep bout duration, number and latency. Sleep bout latency is defined as the time taken (in minutes) for the occurrence of the first sleep bout since respective transitions. The input for this function must be the output from the trimData() function. The output of this function is a matrix which contains fly-wise (each row) data.
Usage
sleepStat(data, sleep.def = c(5), t.cycle = 24, photoperiod = 12)
Arguments
data |
Input data file. The input for this function must be the output of the function trimData(). See ??trimData(). |
sleep.def |
Definition of sleep. Traditionally, a single bout of sleep is defined as any duration of inactivity that is equal to or greater than 5-minutes. However, sometimes it may be of interest to examine longer bouts of sleep or specific bout durations; sleep.def allows users to change the definition of sleep. The default input is a single value vector of value 5. If users wish to analyse sleep only between 5 to 20 mins, the input must be c(5,20). |
t.cycle |
Define the period of the environmental cycle or a single day in hours. This defaults to 24. |
photoperiod |
Duration (in hours) of what can be considered day-phase. This defaults to 12. |
Value
A matrix
array
matrix with 32 rows (one for each fly) and 9 columns:
- Channel
Fly identity.
- Day.BoutNumber
Number of sleep bouts in the user defined day time.
- Day.BoutDuration.Mean
Mean sleep duration in the user defined day time.
- Day.BoutDuration.Median
Median sleep duration in the user defined day time.
- Day.Latency
Time taken for the first sleep bout to occur in the user defined day time.
- Day.Total
Total minutes of daytime sleep.
- Night.BoutNumber
Number of sleep bouts in the user defined night time.
- Night.BoutDuration.Mean
Mean sleep duration in the user defined night time.
- Night.BoutDuration.Median
Median sleep duration in the user defined night time.
- Night.Latency
Time taken for the first sleep bout to occur in the user defined night time.
- Night.Total
Total minutes of nighttime sleep.
Examples
td <- trimData(data = df, start.date = "19 Dec 20", start.time = "21:00",
n.days = 10, bin = 1, t.cycle = 24)
slp.stat <- sleepStat(data = td)