data.frame of long-form data, one column for visitId and one
for ICD code
visitId
single character, if NULL will use "visitId" if exists,
otherwise the first column
icd9Field
single character string with name of column containing the
ICD codes. If left as NULL, the field is guessed to be the first matching
ICD or icd, and a warning is given if multiple columns match.
prefix
character, default "icd_" to prefix new columns
min.width,
single integer, if specified, writes out this many columns
even if no patients have that many codes. Must be greater than or equal to
the maximum number of codes per patient.
aggregate
single logical value, if TRUE (the default) will take more
time to find out-of-order visitIds, and combine all the codes for each
unique visitId. If FALSE, then out-of-order visitIds will result in
a row in the output data per contiguous block of identical visitIds.
return.df
single logical value, if TRUE, return a data frame
with a field for the visitId. This may be more convenient, but the default
of FALSE gives the more natural return data of a matrix with
rownames being the visitIds.