box.plot {figuRes2}R Documentation

box.plot

Description

A function for creating harmonized ggplot2 boxplots

Usage

box.plot(
  parent.df,
  y.col = "AGE",
  y.label = "AGE",
  category.col = "TRTGRP",
  category.label = "Treatment Group",
  y.limits = NULL,
  y.ticks = NULL,
  y.digits = 0,
  shape.palette = c(21, 22),
  category.palette = c(2, 3),
  text.size = 4
)

Arguments

parent.df

data.frame used by ggplot

y.col

parent.df column associated with response vairable

y.label

value gets passed to labs

category.col

data.frame column associated with categorical variable (bar.plot, box.plot, cdf.plot, dot.plot, km.plot)

category.label

passed to x-axis label

y.limits

passed to scale_y_continuous

y.ticks

passed to scale_y_continuous

y.digits

passed to scale_y_continuous label's, fmt (box.plot, line.plot)

shape.palette

values passed to scale_shape_manual

category.palette

colors assoicated with categorical variable

text.size

value gets passed to geom_text

Value

A ggplot object is returned.

Author(s)

Greg Cicconetti

Examples

{
data(demog.data)
# pre-processing

levels(demog.data$SEX) <- c("Female", "Male")

 p1 <- box.plot(parent.df = demog.data, 
     y.col = "BMI", 
     y.label = expression(paste("BMI (m/kg",phantom()^2,")")), 
     category.col = "SEX",
     category.label = "Gender", 
      y.limits = c(0, 70), 
      y.ticks = seq(0, 100, 10), 
      y.digits = 0,
      shape.palette = c(20, 20),
      category.palette = rainbow(6),
      text.size = 4)
 print(p1)
}

[Package figuRes2 version 1.0.0 Index]