R: SAS (if/then statement )in R

后端 未结 4 1461
遥遥无期
遥遥无期 2021-01-16 17:28

I was working previously with SAS and then decided to shift to R for academic requirements reasons. My data (healthdemo) are health data containing some health diagnostic co

4条回答
  •  渐次进展
    2021-01-16 17:52

    I created the icd package to solve this kind of problem. You can use standard groups of diseases, or create your own. It can then quickly plough through all your codes and assign disease groups to each patient. It works with ICD-9 and ICD-10 codes.

    I found plain text processing (like grep in previous answer) was both slow and unreliable. ICD codes have numerous variations in how they are recorded, e.g. an ICD-9 code like X91.9 is equivalent to 0919. String processing for hundreds of thousands of rows was far too slow for me using R functions efficiently, so I wrote the package using a lot of C++, so bigger data users can assign comorbidities to a million patients in a couple of seconds. Hope this helps.

提交回复
热议问题