Description Usage Arguments Value Examples
Plots participants' SLEEP/WAKE intervals.
1 2 3 |
x |
a dataframe. |
datebreaks |
is the distance between breaks in the x-axis. "12 hour" by default. |
base |
matches the participants at the same start date. |
acolor |
specifies the colors for the interval_type. |
decal |
is a parameter for shifting the start date. |
export |
if TRUE, it will export the data as CSV. |
show_plot |
logical to produce the plot or not. |
si |
defines the size of the geom_segment, 8 by default. |
tz |
is the times zone. tz = "UTC" by default. |
tz2 |
an additional time zone used for a secondary x-axis. |
homeTZ |
a data frame containing the all subject_IDs in x and the time zone. It is used for the home night shading. |
shade |
if TRUE, it will draw in light green the home night period. FALSE by default. |
local.shade |
(deprecated) if TRUE, it will draw in gray the local night period. FALSE by default. |
... |
optional parameters. |
a plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library("dplyr")
library("lubridate")
data(act)
dat <- act %>% group_by(subject_ID) %>%
mutate(start = min(datime_start)) %>%
ungroup %>% filter(datime_start <= start + days(10), interval_type != "ACTIVE")
plot_Darwent(dat, acolor = c("#D55E00", "black", "#56B4E9"),
tz2 = "Pacific/Auckland",
si = c(4, 3, 2.5))
# Adding the 'home' night shade
# creating a data frame with the home time zone of the individuals
homeTZ = data.frame(subject_ID = unique(dat$subject_ID),
TZ = rep("Pacific/Auckland", 5),
stringsAsFactors = FALSE)
plot_Darwent(dat, acolor = c("#D55E00", "black", "#56B4E9"),
si = c(4, 3, 2.5),
tz = "UTC", tz2 = "Pacific/Auckland", shade = TRUE,
homeTZ = homeTZ)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.