map_records: Map VA records to coding algorithm.

Description Usage Arguments Value Examples

View source: R/map_records.R

Description

map_records transform data collected with the WHO VA instrument to serve different alogrithms for coding cause of death.

Usage

1
map_records(records, mapping, csv_outfile = "")

Arguments

records

A dataframe, obtained from reading an ODKBriefcase export of records collected with the WHO questionnaire.

mapping

Name of an algorithm to map to (one of "interva4", "insilicova", or "tariff2""), or name of a mapping file.

csv_outfile

Path to a file to write transformed data to. Defaults to empty string, in which case no file is written.

Value

A dataframe, with the VA records mapped to the variables required by a coding algorithm, as specified in the mapping file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
record_f_name <- system.file('sample', 'who_va_output.csv', package = 'CrossVA')
records <- read.csv(record_f_name)
output_data <- map_records(records, 'insilicova')
output_f_name <- "output_for_insilicova.csv"
write.table(
output_data,
output_f_name,
row.names = FALSE,
na = "",
qmethod = "escape",
sep = ","
)
mapping_file <- system.file('mapping', 'interva4_mapping.txt', package = 'CrossVA')
output_data <- map_records(records, mapping_file)
output_f_name <- "output_for_interva4.csv"
write.table(
output_data,
output_f_name,
row.names = FALSE,
na = "",
qmethod = "escape",
sep = ","
)

CrossVA documentation built on Sept. 4, 2017, 5:03 p.m.