accrual_create_df {accrualPlot}R Documentation

accrual_create_df

Description

Creates a data frame or a list of data frames that contains the absolute and cumululative number of participants recruited at each date from a vector with enrollment dates. Used as input for accrual plot functions.

Usage

accrual_create_df(
  enrollment_dates,
  by = NA,
  start_date = "site",
  current_date = "common",
  overall = TRUE,
  name_overall = "Overall",
  pos_overall = c("last", "first"),
  force_start0 = TRUE
)

Arguments

enrollment_dates

date vector with one entry per participants.

by

factor or character vector with sites, has to have the same length as enrollment dates. If not NA, a list with an accrual data frame for each site is generated.

start_date

date when recruitment started. Single date (used for all sites in by), named date vector (with length and names corresponding to the levels of by), "common" (first date overall) or "site" (first date for each site, default).

current_date

date of the data export or database freeze. Single date, named date vector (with length and names corresponding to the levels of by), "common" (last date overall, default) or "site" (first date for each site).

overall

logical indicates that accrual_df contains a summary with all sites (only if by is not NA).

name_overall

name of the summary with all sites (if by is not NA and overall==TRUE).

pos_overall

overall as last or first element of the list (if by is not NA and overall==TRUE).

force_start0

logical, adds an extra 0 line to the accrual data frame in cases where a start date is given and corresponds to the earliest enrollment date.

Value

Returns a data frame of class 'accrual_df' or a list of class 'accrual_list' with an 'accrual_df' for each level of by (if by is not NA). The 'accrual_df' contains a row per accrual day and the following three columns:

Date

date of accrual

Freq

absolute number accrued at Date

Cumulative

cumulative number accrued up to Date

See Also

accrual_plot_cum(), accrual_plot_abs() and accrual_plot_predict() to generate cumulative, absolute and prediction plots, and accrual_table() to generate an accrual table.

Examples


data(accrualdemo)
accrual_create_df(accrualdemo$date)
# different start and current date
accrual_create_df(accrualdemo$date, start_date=as.Date("2020-07-08"),
current_date=as.Date("2020-10-15"))

#by site
accrual_create_df(accrualdemo$date,by=accrualdemo$site)


[Package accrualPlot version 1.0.7 Index]