ConvertData: Converting Input data with different coding scheme to...

View source: R/ConvertData.r

ConvertDataR Documentation

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,
  data.type = c("WHO2012", "WHO2016")[1]
)

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.

data.type

The coding scheme of the output. This can be either "WHO2012" or "WHO2016".

Value

a data frame coded as follows. For WHO2012 scheme: "Y" for yes, "" for No, and "." for missing. For WHO2016 scheme: "y" for yes, "n" for No, and "-" for missing.

See Also

Other data conversion: ConvertData.phmrc()

Examples


# 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


openVA documentation built on March 31, 2023, 9:31 p.m.