generated from opensafely/research-template
/
redact_SMI_traj_change.R
91 lines (52 loc) · 3.07 KB
/
redact_SMI_traj_change.R
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
## Redact SMI smoking == missing as counts <5
## load libraries
## Load libraries
library(pacman)
library(tidyverse)
library(Hmisc)
library(here)
library(arrow)
library(data.table)
library(forcats)
library(rstatix)
library(janitor)
univariate <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_univariate.csv"))
sex <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_sex_adj.csv"))
age <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_age_adj.csv"))
ethnicity <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj.csv"))
imd <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_imd_adj.csv"))
sexage <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_sexage_adj.csv"))
sexageimd <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj.csv"))
sexageeth <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj.csv"))
sexageethimd <- read_csv (here::here ("output/data", "SMI_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj.csv"))
mean_data <- read_csv (here::here ("output/data", "mean_bmi_traj_change_psychosis_schiz_bipolar.csv"))
mean_data <- mean_data %>%
dplyr::filter(group != "M")
univariate <- univariate %>%
dplyr::filter(term != "smoking_statusM")
sex <- sex %>%
dplyr::filter(term != "smoking_statusM")
age <- age %>%
dplyr::filter(term != "smoking_statusM")
imd <- imd %>%
dplyr::filter(term != "smoking_statusM")
sexage <- sexage %>%
dplyr::filter(term != "smoking_statusM")
sexageimd <- sexageimd %>%
dplyr::filter(term != "smoking_statusM")
sexageeth <- sexageeth %>%
dplyr::filter(term != "smoking_statusM")
sexageethimd <- sexageethimd %>%
dplyr::filter(term != "smoking_statusM")
ethnicity <- ethnicity %>%
dplyr::filter(term != "smoking_statusM")
write.csv(ethnicity, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_ethnicity_adj_redact.csv"))
write.csv(univariate, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_univariate_redact.csv"))
write.csv(sex, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_sex_adj_redact.csv"))
write.csv(sexageethimd, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_sexageethimd_adj_redact.csv"))
write.csv(sexageeth, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_sexageeth_adj_redact.csv"))
write.csv(sexageimd, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_sexageimd_adj_redact.csv"))
write.csv(sexage, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_sexage_adj_redact.csv"))
write.csv(imd, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_imd_adj_redact.csv"))
write.csv(age, here::here ("output/data","SMI_lowbmi_excluded_bmi_trajectory_change_age_adj_redact.csv"))
write.csv(mean_data, here::here ("output/data","mean_bmi_traj_change_psychosis_schiz_bipolar_redact.csv"))