visGroup: Group level plots

View source: R/visGroup.R

visGroupR Documentation

Group level plots

Description

Group level plots of minutes of activity per day

Usage

visGroup(data,ID,activity,type,title,yaxis,xaxis,time,legendTitle,
         groupBy,groupFun,levels,heatcol)

Arguments

data

Summary data by day

ID

Name of column that identifies groups or individuals

activity

Name of column for activity to be plotted

type

Type of plot. Options 'boxplot' or 'heatmap'

title

Title of the plot

yaxis

Axis title for vertical axis

xaxis

Whether to pring the x axis label. Options are TRUE or FALSE

time

Name of column that contains time index

legendTitle

Title of legend for 'type=heatmap'

groupBy

Option to plot by group, for 'type=heatmap'

groupFun

If groupBy is specified, how are two groups defined? Provide a function to specify a statistic that divides the groups. For example, specify 'median' to divide the two groups by the overall median of the data.

levels

Specifies thresholds for heatmap. For example, user can specify 'levels = c(0,300,600,1440)' to plot a heatmap of four levels.

heatcol

Specifies colors for the heatmap.

Value

A plot is returned.

Author(s)

Jaejoon Song <jjsong2@mdanderson.org>

Examples


##
## Example: A box plot
##
## Not run: 
library(acc)
data(NHANES)
NHANES_subset <- NHANES[1:300,]
visGroup(
data = NHANES_subset,
activity = 'wearTime',
ID = 'ID',
type = 'boxplot',
title = "Wear time at baseline",
yaxis = "Wear time (minutes per day)",xaxis=TRUE)


##
## Example: A heatmap
##
library(acc)
data(NHANES)
NHANES_subset <- NHANES[1:1000,]

visGroup(
data = NHANES_subset,
ID = 'ID',activity = 'wearTime',
type = 'heatmap',title = "Wear time at baseline",
yaxis = "ID",time = 'Day',
legendTitle = "Wear time",
groupBy = 'VO2max',groupFun = 'median',
levels = c(0,300,600,1440),
heatcol = c("white","mistyrose","lightpink","violetred1"))

## End(Not run)

github-js/acc documentation built on Aug. 21, 2023, 5:40 p.m.