internalCheckNBC {nbc4va} | R Documentation |
Check arguments for nbc()
Description
Performs checks to ensure that the arguments passed to internalNBC
are correct.
This function will also auto-clean when appropriate, and display
warning messages of the cleaning tasks.
Usage
internalCheckNBC(train, test, known = TRUE, assume = FALSE, unknown = 99)
Arguments
train |
Dataframe of verbal autopsy train data (See Data documentation).
Example:
| ||||||||||||||||||||
test |
Dataframe of verbal autopsy test data in the same format as train except if causes are not known:
| ||||||||||||||||||||
known |
TRUE to indicate that the test causes are available in the 2nd column and FALSE to indicate that they are not known | ||||||||||||||||||||
assume |
TRUE to set all symptoms not equal to 1 as 0 and FALSE to raise error if symptoms are not 0 or 1. This takes priority over unknown. | ||||||||||||||||||||
unknown |
A single integer value which determines if a symptom is unknown as to if is present or absent.
|
Details
The following checks are applied to train and test to ensure they:
are a dataframe
have required number of rows and columns
have required data types for each column
have required symptom values
are in the same format
have unique ids
Value
out A list object containing the checked inputs:
$train: dataframe of id, cause and symptoms
$test: dataframe of id, cause and symptoms in the same format as train
$known: TRUE if the test causes are known or FALSE if not
See Also
Other validation functions:
internalCheckNBCSummary()
Examples
library(nbc4va)
data(nbc4vaData)
# Check train and test inputs, error if it does not pass check
train <- nbc4vaData[1:50, ]
test <- nbc4vaData[51:100, ]
checked <- nbc4va::internalCheckNBC(train, test)
train <- checked$train
test <- checked$test