Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ggcircadian

Circadian Plot by Group


Description

Converts the output of card::circ_compare_groups into a complex geom that is broken down by time/hour and HRV (or any other continuous variable). Each hour is then separated by the grouping variable.

Usage

ggcircadian(
  data,
  outcome,
  time = "hour",
  mean = "mean",
  n = "n",
  sd = "sd",
  se = "se",
  pval = "pval"
)

Arguments

data

Table generated which has time variable, categorical outcome variable, and summary statistics, including a possible column called "pval" which, if present, will document statistical significance in plot.

outcome

Name of categorical variable to stratify the y-axis

time

Name of time group variable, such as hours of day, which ends up being the x-axis

mean, n, sd, se, pval

Summary statistics to be included in graphics.

Details

Currently creates a ggplot that shows a error bar and point estimate of values by group (e.g. clinical status). If t-test values are available in the data frame, shows points of significance.

Value

Returns a ggplot object of geom type, other layers can be added on as seen in example.

Examples

# Data
data(twins)
tbl <- circ_compare_groups(twins, "rDYX", "sad_cat", "hour")

# Plot
library(ggplot2)
ggcircadian(tbl, outcome = "sad_cat") +
  labs(title = "Example") +
  scale_color_viridis_d(option = "A", begin = 0.0, end = 0.75)

card

Cardiovascular and Autonomic Research Design

v0.1.0
MIT + file LICENSE
Authors
Anish S. Shah [aut, cre, cph] (<https://orcid.org/0000-0002-9729-1558>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.