df <- data.frame(
start = as.POSIXct(c(
"2024-09-07 06:12", "2024-09-07 06:15", "2024-09-07 05:45",
"2024-09-07 04:57", "2024-09-07 06:12", "2024-09-07 06:18"
)),
end = as.POSIXct(c(
"2024-09-07 06:12", "2024-09-07 06:18", "2024-09-07 06:12",
"2024-09-07 05:45", "2024-09-07 06:15", "2024-09-07 07:37"
)),
stage = c(
"Awake", "Awake", "REM",
"Core", "Core", "Deep"
),
stringsAsFactors = FALSE
)
stage_order = c( "Deep", "Core","REM", "Awake")
df |>
e_charts() |>
e_stage(start = start,
end = end,
stage = stage) |>
e_x_axis(type = 'time') |>
e_y_axis(type = 'category', data = stage_order)
Run the code above in your browser using DataLab