Skip to content

Instantly share code, notes, and snippets.

@fusaroli
Created May 29, 2020 12:43
Show Gist options
  • Save fusaroli/d5dacea534747d914699f9a30c7ea874 to your computer and use it in GitHub Desktop.
Save fusaroli/d5dacea534747d914699f9a30c7ea874 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(data.table)
temp <- read_delim("~/Downloads/temp.csv", delim = ";")
setDT(temp)
r <- ":acute interstitial pneumonitis:|:alveolar lung disease:|:alveolar proteinosis:|:alveolitis:|:alveolitis necrotising:|:autoimmune lung disease:|:bronchiolitis:|:combined pulmonary fibrosis and emphysema:|:diffuse alveolar damage:|:eosinophilia myalgia syndrome:|:eosinophilic granulomatosis with polyangiitis:|:eosinophilic pneumonia:|:eosinophilic pneumonia acute:|:eosinophilic pneumonia chronic:|:hypersensitivity pneumonitis:|:idiopathic interstitial pneumonia:|:idiopathic pneumonia syndrome:|:idiopathic pulmonary fibrosis:|:immune-mediated pneumonitis:|:interstitial lung disease:|:lung infiltration:|:lung opacity:|:necrotising bronchiolitis:|:obliterative bronchiolitis:|:pneumonitis:|:progressive massive fibrosis:|:pulmonary fibrosis:|:pulmonary necrosis:|:pulmonary toxicity:|:pulmonary vasculitis:|:small airways disease:|:transfusion-related acute lung injury:|:acute lung injury:|:acute respiratory distress syndrome:|:airway remodelling:|:allergic eosinophilia:|:antisynthetase syndrome:|:biopsy lung abnormal:|:complications of transplanted lung:|:cystic lung disease:|:goodpasture's syndrome:|:granulomatosis with polyangiitis:|:granulomatous pneumonitis:|:langerhans' cell histiocytosis:|:lung induration:|:lung transplant rejection:|:lupus pneumonitis:|:lymphangioleiomyomatosis:|:organising pneumonia:|:polyarteritis nodosa:|:pulmonary alveolar haemorrhage:|:pulmonary eosinophilia:|:pulmonary granuloma:|:pulmonary haemosiderosis:|:pulmonary renal syndrome:|:pulmonary sarcoidosis:|:restrictive pulmonary disease:|:rheumatoid lung:|:sarcoidosis:|:systemic sclerosis pulmonary:|:toxic oil syndrome:|:pneumonia:|:pleural effusion:|:eosinophilic pleural effusion:"
temp[, reac := grepl(r, pt, fixed = F)]
EA <- temp[reac == T, .N]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment