Takes data and returns a summary table of continuous variable based on a categorical variable. This summary is repeat by time groups to help describe a circadian pattern.

circ_compare_groups(data, x, y, time)

Arguments

data

Dataframe containing all the following variables

x

Continuous variable of interest (x ~ y)

y

Grouping variable to apply to the cvar (x ~ y). Must be binary for t-test, otherwise will return data set without pvalues

time

Name of the time-dependent variable, usually hours

Value

Returns a dataframe that has the time variable, the categorical variable, and the statistics (including p-value) of the continuous variable

Details

Applies a simple data transformation to identify the summary statistics of the data frame by the stated variables. Results in a mean, standard deviation, and standard error term. This data is also used for making a t-test based table, which can then also be graphed in ggcircadian.

Examples

data("twins") circ_compare_groups(data = twins, x = "rDYX", y = "sad_cat", time = "hour")
#> # A tibble: 120 x 6 #> hour sad_cat mean n sd se #> <fct> <fct> <dbl> <int> <dbl> <dbl> #> 1 8 bdi_I 3.22 426 0.780 0.0378 #> 2 9 bdi_I 3.24 417 0.810 0.0397 #> 3 10 bdi_I 3.28 379 0.799 0.0411 #> 4 11 bdi_I 3.19 324 0.808 0.0449 #> 5 12 bdi_I 3.00 338 0.807 0.0439 #> 6 13 bdi_I 2.89 434 0.681 0.0327 #> 7 14 bdi_I 2.95 449 0.689 0.0325 #> 8 15 bdi_I 3.05 459 0.749 0.0350 #> 9 16 bdi_I 3.02 469 0.730 0.0337 #> 10 17 bdi_I 2.85 469 0.724 0.0334 #> # … with 110 more rows