-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPERMIT Creating crea.rep
More file actions
42 lines (27 loc) · 1.08 KB
/
PERMIT Creating crea.rep
File metadata and controls
42 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#This file recreates crea.rep based on demographic variables from the sir.data.rda in the processed directory,
#and the long format original sir.data file.
#The purpose of this is to acquire the Source column from the long file.
#Following selection of adult hf patients but prior to selecting out diabetics
names(sir.data)
small<-sir.data[,c(1,8,9,12,13)]
small<-unique(small)
table(small$PatientID) >1 -> varied
table(varied) #check there is no conflicting information
save(small,file="small.rda")
#This is the demographic data from he processed sir.data.rda,
#comprising PatientID, Gender, BirthDate and LSOA
memory.size(100000)
#load("small.rda")
load("sir.data.rda")
#This is the long format original sir.data.rda file
###########################################################
library(zoo)
library(plyr)
library(tidyverse)
library(zoo)
library(data.table)
library(survival)
library(lubridate)
crea<-sir.data[sir.data$PatientID %in% small$PatientID & sir.data$ReadCode=="44J3.",]
crea<-merge(crea[!is.na(crea$PatientID),],small,all.x=TRUE)
save(crea,file="revisedcrea.rda")