Description Usage Arguments Details Value Examples
View source: R/mylongevity_double_cox_method2.r
This function loads a file as a data frame of clients. Using the argument 'indexes_of_variables', this function selects the columns of factors and matches them to outcomes of life expectancy calculator from hormone replace therapy study
1 2 3 4 5 6 | mylongevity_double_cox_method2(
data,
indexes_of_variables,
age_of_diagnosis,
time_past_from_diagnosis
)
|
data |
given data frame of clients |
indexes_of_variables |
indices for columns of interest |
age_of_diagnosis |
age of start of intake for hormone replace therapy |
time_past_from_diagnosis |
time past from start of hormone replace therapy in years |
This method matches the attributes of inputted data with results of hazard ratios from hormone replace therapy study and produces a table with life expectancies For mylongevity_double_cox_method2, user has to specify the data and columns using the argument indexes_of_variables in following order: B_cohort,BMIsmoke,CHD,deprivation,DMIIsmoke,hrtcat,hypertension,opho
The definition of columns are: - B_cohort : indicator for year of birth (0 - born in 1921-1930 , 1 - born in 1931-1940, 2 - born in 1941-1950, 3 - born in 1951-1960) - BMIsmoke : indicator for interaction for body mass index and smoking (0 - Healthy or Overweight and Non Smoker, 1 - healthy weight and current smoker, 2 - healthy weight and ex smoker, 3, Obese and current smoker, 4 - Obese and exsmoker, 5 - Obese and non smoker) - CHD : indicator for heart failure (0 - absence of coronary heart disease , 1 - presence of coronary heart disease) - hrtcat : indicator for type of hormone replacement therapy (0 - non users of hormone replacement therapy, 1 - Combined Oestrogen and Progesteron , 2 - Oestrogen-only) - DMIIsmoke : interaction of diabetes and smoking variables (0 - non diabetic and non smoker,1 - non diabetic and current smoker ,2 - non diabetic and ex-smoker,3 - diabetic and current smoker,4 - diabetic and ex smoker ,5 - diabetic and non-smoker) - opho : indicator of cases control group (1 - both uterus and ovarian removed, 2 - ovaries removed but not uteras) - hypertension: indicator for hypertension (0 - absence of Hypertension, 1 - Hypertension) - smokes: indicator of smoking status (0 non smoker, 1 - former smoker, 2 - current smoker) - deprivation - deprivation index (0 - Low (Townsend 1 and Townsend 2), 1 - High (Townsend 4 and Townsend 5), 2 - Medium (Townsend 3))
data frame with life expectancies for given data frame of clients
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(1234)
n<-1000
B_cohort<-round(runif(n, min = 0, max = 3)) # indicator for year of birth (0 - born in 1921-1930 , 1 - born in 1931-1940, 2 - born in 1941-1950, 3 - born in 1951-1960)
BMIsmoke<-round(runif(n, min = 0, max = 5)) # indicator for interaction for body mass index and smoking (0 - Healthy or Overweight and Non Smoker, 1 - healthy weight and current smoker, 2 - healthy weight and ex smoker, 3, Obese and current smoker, 4 - Obese and ex-smoker, 5 - Obese and non-smoker)
CHD<-round(runif(n, min = 0, max = 1)) # indicator for heart failure (0 - absence of coronary heart disease , 1 - presence of coronary heart disease)
hrtcat<-round(runif(n, min = 0, max = 2)) # indicator for type of hormone replacement therapy (0 - non users of hormone replacement therapy, 1 - Combined Oestrogen and Progesteron , 2 - Oestrogen-only)
DMIIsmoke<-round(runif(n, min = 0, max = 5)) # interaction of diabetes and smoking variables (0 - non diabetic and non smoker,1 - non diabetic and current smoker ,2 - non diabetic and ex-smoker,3 - diabetic and current smoker,4 - diabetic and ex smoker ,5 - diabetic and non-smoker)
opho<-round(runif(n, min = 1, max = 2)) # indicator of cases control group (0 - both uteras and ovarian not removed, 1 - both uteras and ovarian removed, 2 - ovaries removed but not uteras)
hypertension<-round(runif(n, min = 0, max = 1)) # indicator for hypertension (0 - absence of Hypertension, 1 - Treated Hypertension 2 - Untreated Hypertension)
deprivation <-round(runif(n, min = 0, max = 2))# deprivation index (0 - Low (Townsend 1 and Townsend 2), 1 - High (Townsend 4 and Townsend 5), 2 - Medium (Townsend 3))
data<-data.frame(B_cohort,BMIsmoke,CHD,deprivation,DMIIsmoke,hrtcat,hypertension,opho)
indexes_of_variables <- c(1,2,3,4,5,6,7,8)
age_of_diagnosis=45
time_past_from_diagnosis=1
mylongevity_double_cox_method2(data, indexes_of_variables, age_of_diagnosis, time_past_from_diagnosis)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.