uwAccrualBars: Bar plot of frequency of accural

Description Usage Arguments Value Author(s) See Also Examples

View source: R/uwAccrualBars.R

Description

Bar plot of frequency of accural by days, months, or years. Mostly for DSMB use to assess accural

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
uwAccrualBars(
  accData,
  dateName,
  trxName = NULL,
  interval = c("months", "days", "years"),
  startDate = NULL,
  currentDate = NULL,
  pTitle = "Accrual Over Time",
  yLab = NULL,
  xLab = NULL,
  yLim = NULL,
  pHoriz = FALSE,
  pBeside = TRUE,
  linedbars = FALSE,
  printBarVals = TRUE,
  Legend = FALSE,
  LegendLoc = "topright",
  LegendCex = 0.8,
  cex.names = 1,
  titleCex = 1,
  barNamesLas = 1,
  barNamesSeq = 1,
  barNamesAngle = 0
)

Arguments

accData

Data frame which includes an accural date for each patient

dateName

(string) Variable name in accData indicating the date of accrual. Must be a variable with class type 'dates' from library(chron). The function will try to coherece a non-dates variable into a m/d/y formatted dates class

trxName

(string) Optional string giving the name of the variable in accData that indicates treatment assignment. If used, then accrual for each time point is given separately for each treatment level. If NULL then any possible treatment levels are collapsed and treated as one large group

interval

(string) Indicator of which time interval is to be presented. Default is 'months'. 1 letter abbreviation is sufficient

startDate

(date) Specify the start date of accrual. Defaults to the minimum date of dateName

currentDate

(date) Specify the current date. Defaults to the maximum date of dateName

pTitle

(string) Title of graphic

yLab

(string) Y label of graphic

xLab

(string) X label of graphic

yLim

(numeric) Limits of y axis of graphic. Default is the default of barplot

pHoriz

(logic) horiz attribute for barplot(). TRUE prints bars horizontally

pBeside

(logic) beside attribute for barplot(). FALSE prints stacked bars, TRUE prints side-by-side bars

linedbars

(logic) TRUE for lined bars, FALSE for solid colored bars

printBarVals

(logic) TRUE for the frequency of each bar to be plot on top of the bars. 0 values are suppressed from being printed

Legend

(logic) TRUE for Legend to be printed. Only feasible if trxName is not NULL.

LegendLoc

(string) Strings allotted in legend() to be used as a location for the legend. See help(legend) for further explanation.

LegendCex

(numeric) Multiplicative factor of printing size of legend

cex.names

(numeric) Multiplicative factor of printing size of legend axis label

titleCex

(numeric) Multiplicative factor of printing size of title

barNamesLas

(0,1,2 or 3) Option for axis labels to be horizontal or veritcal

barNamesSeq

(integer) Number indicating which time labels to print. This number is given as the 'by' attribute to seq(). So every barNameSeq would be printed. Default is 1, which will print all time labels. Mostly helpful when interval='d'

barNamesAngle

(integer) Number between 0 and 360 that gives the angle in which the axis names will be printed.

Value

invisible

Author(s)

Scott J Hetzel MS. UW-Madison Department of Biostatistics and Medical Informatics. Contributions from Patrick Lenon. Frontier Science and Technology Research Foundation

See Also

uwBars

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Dates <- c(
  "03/01/2008", "09/01/2007", "07/01/2007", "12/01/2006", "08/01/2007", "08/01/2007",
  "04/01/2007", "04/01/2007", "04/01/2007", "11/01/2006", "11/01/2006", "12/01/2006",
  "12/01/2006", "10/01/2006", "01/01/2007", "11/01/2006", "12/01/2006", "02/01/2007",
  "08/01/2007", "08/01/2006", "09/01/2006", "04/01/2007", "05/01/2007", "11/01/2006",
  "10/01/2006", "03/01/2007", "10/01/2007", "07/01/2007", "03/01/2007", "05/01/2006",
  "05/01/2006", "11/01/2006", "12/01/2006", "02/01/2007", "02/01/2007", "02/01/2007",
  "04/01/2007", "05/01/2007", "07/01/2007", "08/01/2007", "11/01/2007", "10/01/2007",
  "09/01/2007", "10/01/2007", "05/01/2007", "01/01/2008", "12/01/2006", "02/01/2007",
  "03/01/2007", "04/01/2007", "04/01/2007", "05/01/2007", "07/01/2007", "02/01/2007",
  "07/01/2007", "10/01/2007", "01/01/2008"
)

Date <- chron::chron(Dates, format = c(dates = "m/d/y"))
TRT <- rep(c("A", "B"), c(30, 27))

data <- data.frame(Date, TRT)

layout(matrix(c(1, 2, 3, 4), nrow = 2, byrow = TRUE))
uwAccrualBars(
  accData = data, dateName = "Date", trxName = NULL, pTitle = "Accural",
  yLab = "Months", xLab = "Number of Patients",
  interval = "m", yLim = NULL, pHoriz = TRUE, pBeside = TRUE,
  linedbars = FALSE, Legend = TRUE, LegendLoc = "right",
  LegendCex = 0.5, cex.names = 0.7, barNamesLas = 1
)

uwAccrualBars(
  accData = data, dateName = "Date", trxName = NULL, pTitle = "Test",
  yLab = "Number of Patients", xLab = "Day", startDate = "01/01/2005", currentDate = "12/31/2010",
  interval = "d", yLim = NULL, pHoriz = FALSE, pBeside = TRUE,
  linedbars = TRUE, Legend = FALSE, LegendLoc = "topleft",
  LegendCex = 0.6, cex.names = 0.8, barNamesSeq = 40
)

uwAccrualBars(
  accData = data, dateName = "Date", trxName = NULL, pTitle = "Bars",
  yLab = "Months", xLab = "Number of Subjects", printBarVals = FALSE,
  interval = "y", yLim = NULL, pHoriz = TRUE, pBeside = FALSE,
  linedbars = TRUE, Legend = FALSE, LegendLoc = "bottomleft",
  LegendCex = 0.7, cex.names = 0.9
)

uwAccrualBars(
  accData = data, dateName = "Date", trxName = NULL,
  interval = "m", yLim = NULL, pHoriz = FALSE, pBeside = FALSE,
  linedbars = FALSE, Legend = TRUE
)

jbirstler/biostatrpts documentation built on May 7, 2020, 12:10 a.m.