medcodes_to_read: Translate CPRD medcodes to Read/Oxmis
Description
This function accepts a data frame with a column for CPRD medcodes and merges with a medical lookup table to give columns for Read/OXMIS codes and optional descriptions
Usage
medcodes_to_read(medcodes_data, lookup_table, medcodes_name = "medcode", lookup_readcodes = "readcode", lookup_medcodes = "medcode", description = TRUE)
Arguments
medcodes_data
a dataframe with a column matching medcodes_name
lookup_table
a dataframe with columns matching lookup_readcodes and lookup_medcodes
medcodes_name
character name of the CPRD medcodes column in medcodes_data
lookup_readcodes
character name of the Read codes column in the lookup_table
lookup_medcodes
character name of the CPRD medcodes column in the lookup_table
description
logical Should description and other categories from the lookup table also be included?
Value
a data frame matching the input medcodes_data with the Read codes and optional description columns merged in.
Details
Note that if the names of the medcodes columns are different in the data and the lookup table, the name in the data is retained
To maintain sanity, a warning will be given to inform of are any name conflicts between the input data and the lookup