title: R: Creating a IC9-Code Description Variable using the ICD-9 package
body: <p>I have a dataset that contains 3-digit ICD-9 codes and I want to create a ICD9 description variable based on the 3 digit codes. Here is a code to replicate my dataset:</p>
  
  <pre><code>id=c(1:5);icdcode=c("786","401","780","300","V30");df=data.frame(id,icdcode)
  </code></pre>
  
  <p>I used the following code to create a new var "icd9.explain":</p>
  
  <pre><code>df$icd.explain=icd9ExplainShort(as.character(df$icdcode))
  </code></pre>
  
  <p>My resulting dataset looks like this:</p>
  
  <pre><code>&gt; df
    id icdcode                                    icd.explain
  1  1     786 Anxiety, dissociative and somatoform disorders
  2  2     401 Anxiety, dissociative and somatoform disorders
  3  3     780 Anxiety, dissociative and somatoform disorders
  4  4     300 Anxiety, dissociative and somatoform disorders
  5  5     V30 Anxiety, dissociative and somatoform disorders
  </code></pre>
  
  <p>Does anyone have an idea about how I can get the correct code explanations?</p>
  
  <p>Thanks!! </p>