stages_stats computes stages related statistics.

stages_stats(e)

Arguments

e

Events dataframe. Dataframe must have begin (POSIXt), end (POSIXt) and event (character) columns.

Value

stages vector

Examples

e <- data.frame(begin = as.POSIXlt(seq(from = 0, to = 30*10, by = 30),origin = "1970-01-01"))
e$end <- as.POSIXlt(seq(from = 30, to = 30*11, by = 30), origin = "1970-01-01")
e$event = c("AWA","N1","N2","N3","N3","REM","N2","REM","N2","REM","AWA")
stages_stats(e)
#> rem_duration  n1_duration  n2_duration  n3_duration awa_duration          tts 
#>    1.5000000    0.5000000    1.5000000    1.0000000    1.0000000    4.5000000 
#>      rem_tts       n1_tts       n2_tts       n3_tts      awa_tts          tsp 
#>    0.3333333    0.1111111    0.3333333    0.2222222    0.2222222    5.5000000 
#>   efficiency      latency   n1_latency   n2_latency   n3_latency  rem_latency 
#>    0.8181818    0.5000000    0.0000000    0.5000000    1.0000000    2.0000000 
#>         waso 
#>    0.5000000