#take only the Participant data from sample data, and three days
library(dplyr)
library(lubridate)
library(ggplot2)
sample.data <-
sample.data.environment %>%
dplyr::filter(Id == "Participant") %>%
filter_Date(length = ddays(3))
#create a double plot with the default settings
sample.data %>% gg_doubleplot()
#repeat the same day in the plot
sample.data %>% gg_doubleplot(type = "repeat")
#use the function with more than one Id
sample.data.environment %>%
filter_Date(length = ddays(3)) %>%
gg_doubleplot(aes_fill = Id, aes_col = Id) +
facet_wrap(~ Date.data, ncol = 1, scales = "free_x", strip.position = "left")
#if data is already grouped by days, type = "repeat" will be automatic
sample.data.environment %>%
dplyr::group_by(Date = date(Datetime), .add = TRUE) %>%
filter_Date(length = ddays(3)) %>%
gg_doubleplot(aes_fill = Id, aes_col = Id) +
guides(fill = "none", col = "none") + #remove the legend
facet_wrap(~ Date.data, ncol = 1, scales = "free_x", strip.position = "left")
#combining `aggregate_Date()` with `gg_doubleplot()` easily creates a good
#overview of the data
sample.data.environment %>%
aggregate_Date() %>%
gg_doubleplot()
Run the code above in your browser using DataLab