compare_groups: Prints statistics on dataset, grouped by group assignments

Description Usage Arguments Value Examples

View source: R/experiments.R

Description

Groups the dataset by each group assignment named in names_of_groupings (must be found in person$groupings, or passed in as a dataframe in the list of addl_grouping_assignments). Prints statistics by group.

Usage

1
2
compare_groups(dataset, person, names_of_groupings = NA,
  addl_grouping_assignments = NA, variables_to_compare)

Arguments

dataset

dataset from create_dataset that contains all variables and measures of interest

person

an instantiated Person object

names_of_groupings

names of groupings to test (default is groupings in person$groupings)

addl_grouping_assignments

list of named dataframes, where each data frame provides a mapping from a value of a specified variable to group on to the group assignment for observations with that value for that variable

variables_to_compare

variables to print grouped statistics on

Value

NULL - prints statistics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(EX)

dataset <- create_dataset(person = EX, all_variables = list("util" = c("month"), 
                                  "fitbit_daily" = c("sleepDuration", "steps",
                                  "restingHeartRate")), time_var = c("date"))
                                  
indiv_months <- data.frame("month"= c("Jan", "Feb", "Mar", "Apr", "May",
                                      "Jun", "Jul", "Aug", "Sep", "Oct", 
                                      "Nov", "Dec"),
                           "group" = c(1:12))
compare_groups(dataset, person = EX, 
            addl_grouping_assignments = list("indiv_months" = indiv_months), 
            names_of_groupings = c("indiv_months"),
            variables_to_compare = c("steps", "restingHeartRate"))

       

lifelogr documentation built on May 2, 2019, 6:11 a.m.