Learn R Programming

openVA (version 1.0.1)

ConvertData: Converting Input data with different coding scheme to standard format

Description

Converting Input data with different coding scheme to standard format

Usage

ConvertData(input, yesLabel = NULL, noLabel = NULL, missLabel = NULL)

Arguments

input
matrix input, the first column is ID, the rest of the columns each represent one symptom
yesLabel
The value(s) coding "Yes" in the input matrix.
noLabel
The value(s) coding "No" in the input matrix.
missLabel
The value(s) coding "Missing" in the input matrix.

Value

a matrix with coding scheme as follows: "Y" for yes, "" for No, and "." for missing.

Examples

Run this code

# make up a fake 2 by 3 dataset with 2 deaths and 3 symptoms
id <- c("d1", "d2")
x <- matrix(c("Yes", "No", "Don't know",
			  "Yes", "Refused to answer", "No"),
			byrow = TRUE, nrow = 2, ncol = 3)
x <- cbind(id, x)
colnames(x) <- c("ID", "S1", "S2", "S3")
# see possible raw data (or existing data created for other purpose)
x
new <- ConvertData(x, yesLabel = "Yes", noLabel = "No",
			missLabel = c("Don't know", "Refused to answer"))
new

Run the code above in your browser using DataLab