A brief first post on what I hope will be a series of posts on analysing hospitilisation data, which is recorded using ICD codes (International Statistical Classification of Diseases and Related Health Problems)
Initially here is an R file. This can be read in and will create a list, 218 long, forming groupings using sub chapters of the ICD coding systems. With this you can then loop through your file of hospitilisations doing string searches (which sadly isn’t R’s strength really), and get counts of how many times your subjects are hospitilised for causes.
I’m still working on my string searching code but it is coming along nicely, so I will post this shortly and hopefully have some rough times for how long they take to run on different datesets. Currently I’m working with two files, 1.7 mil and 1.3 mil rows, with up to 21 diagnosis codes per record (row).
Below is a link to a file is a ‘dictionary’ for the abbreviated names used in the function above.