LoadData {RCTRecruit}R Documentation

Load recruitment data.

Description

This function must be called before any other function in this package. LoadData
checks the input data and stores the results internally for the session.
Calling this function more than once in the same session will overwrite the
previously created internal data.

Usage

LoadData(data, date, enrolled)

Arguments

data

Main dataset containing at least two columns:

  • A date column with the calendar date of the screening

  • A enrolled column with the number of subjects enrolled

If the entries cover a period longer than 1 year, only the entries within
one year prior to the latest date will be retained.

date

The name (symbol or string) of the column in the dataset with the calendar
dates of active screening. All active calendar dates should be included, even
if the recruitment for that date is 0. Only dates with truly non-active
recruitment should be omitted. The date column must be:

  • an object inheriting from class the Date class

  • or a character vector with a valid date format.

enrolled

The name (symbol or string) of the column in the dataset with the number of
subjects recruited on the corresponding calendar date. It must be a numeric vector.

Value

This function does not return any value. It runs several tests and proccesses
the data and stores internally the results. It prints a message to the console
if the data is successfully loaded or an error message if there is an issue
with the input data. Once the dataset is loaded, the following functions can
be used:

See Also

Other Links: GetDistance(), GetWeekPredCI(), RCTRecruit-package, Time2Nsubjects(), gripsYR1, gripsYR2, gripsYR2Weekly, plot.RCTPredCI()

Examples

# Load using names as symbols
LoadData(gripsYR1, ScreenDt, Enrolled)

# Load using names as strings
LoadData(gripsYR1, "ScreenDt", "Enrolled")

# Load using base pipe operator
gripsYR1 |> LoadData(ScreenDt, Enrolled)

# Load using magrittr pipe operator
if (base::requireNamespace("magrittr", quietly = TRUE)) {
  library(magrittr)
  gripsYR1 %>% LoadData(ScreenDt, Enrolled) 
}

[Package RCTRecruit version 0.2.0 Index]