ggperio: Prepare a ggplot object to represent periodogram data

Description Usage Arguments Value References See Also Examples

View source: R/ggperio.R

Description

This function summarises periodogram data (containing periodograms of multiple individual), to show period on the x axis, and power (or equivalent) on the y axis.

Usage

1
ggperio(data, mapping = aes(x = period, y = power), ...)

Arguments

data

behavr::behavr table containing the data and metadata

mapping

default list of aesthetic mappings to use for plot

...

additional arguments to be passed to ggplot2::ggplot()

Value

An initial ggplot object that can be further edited.

References

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
require(zeitgebr)
# We make toy data
metadata <- data.table(id = sprintf("toy_experiment|%02d", 1:40),
                       region_id = 1:40,
                       condition = c("A", "B"),
                       sex = c("M", "M", "F", "F"))
dt <- toy_activity_data(metadata, seed = 107)
# We shift period of the group "A" by 0.01
dt[, t := ifelse(xmv(condition) == "A", t, t * 1.01)]
# We  compute a periodogram for each individual
per_dt <- periodogram(moving, dt, FUN = chi_sq_periodogram)

# Then we display them as an average
out <- ggperio(per_dt, aes(y = power, colour = condition))
out +  stat_pop_etho()

out <- ggperio(per_dt, aes(y = power - signif_threshold, colour = condition))
out +  stat_pop_etho()
out <- ggperio(per_dt, aes(y = power - signif_threshold, colour = condition))
out +  stat_pop_etho() + facet_wrap( ~ id, labeller = id_labeller)

ggetho documentation built on April 30, 2020, 1:06 a.m.