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:
If the entries cover a period longer than 1 year, only the entries within |
date |
The name (symbol or string) of the column in the dataset with the calendar
|
enrolled |
The name (symbol or string) of the column in the dataset with the number of |
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:
-
Time2Nsubjects()
: simulates the number of weeks needed to recruit a
given number of subjects -
GetDistance()
: calculates the Euclidean distance between the
predicted and actual recruitment -
GetWeekPredCI()
: calculates the median recruitment with 95% CI for
up to the next 104 weeks (two years)
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)
}