Skip to content

Commit

Permalink
edit 1_find_variables.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwright committed Jun 11, 2024
1 parent fb74a5e commit a2333d3
Showing 1 changed file with 0 additions and 94 deletions.
94 changes: 0 additions & 94 deletions code/1_find_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,97 +168,3 @@ binary_dict <- c("No", "Yes")
rm(get_lookup)

save(list = ls(), file = "Data/helpers.Rdata")

# # 3. Sample and Attrition ----
# ## a. MCS ----
# mcs <- list()
#
# mcs$sample <- df_file %>%
# filter(study == "mcs",
# variable == "NOCMHH") %$%
# load_mcs(file_path, variable) %>%
# filter(nocmhh %in% 1:2) %>%
# uncount(nocmhh, .id = "cnum") %>%
# mutate(iid = row_number())
#
# mcs$attrit <- df_file %>%
# filter(study == "mcs",
# variable == "NOCMHH") %$%
# load_mcs(file_path) %>%
# right_join(mcs$sample, by = "mcsid") %>%
# select(iid, matches("aoutc00")) %>%
# pivot_longer(-iid) %>%
# mutate(sweep = match(str_sub(name, 1, 1), letters),
# observed = case_when(sweep == 1 & value == 2 ~ 1,
# sweep %in% 2:7 & value == 1 ~ 1,
# TRUE ~ 0)) %>%
# select(iid, sweep, observed)
#
# ## b. Next Steps ----
# next_steps <- list()
#
# next_steps$sample <- df_file %>%
# filter(study == "next_steps",
# variable == "MAINBOOST") %$%
# load_next_steps(file_path) %>%
# mutate(iid = row_number(),
# boost = mainboost - 1) %>%
# select(nsid, iid, boost)
#
# next_steps$attrit <- df_file %>%
# filter(study == "next_steps",
# variable == "MAINBOOST") %$%
# load_next_steps(file_path) %>%
# select(nsid, matches("outcome")) %>%
# mutate(across(matches("outcome"), ~ ifelse(.x %in% 1, 1, 0))) %>%
# pivot_longer(-nsid, values_to = "observed") %>%
# mutate(sweep = str_sub(name, 2, 2) %>% as.integer()) %>%
# left_join(next_steps$sample, by = "nsid") %>%
# select(iid, sweep, observed)
#
# ## b. BCS70 ----
# bcs70 <- list()
#
# bcs70$sample <- df_file %>%
# filter(study == "bcs70",
# variable == "MULTIPNO") %$%
# load_file(file_path) %>%
# mutate(iid = row_number()) %>%
# select(bcsid, iid)
#
# bcs70$attrit <- df_file %>%
# filter(study == "bcs70",
# variable == "MULTIPNO") %$%
# load_bcs70(file_path) %>%
# left_join(bcs70$sample, by = "bcsid") %>%
# select(iid, matches("outcme")) %>%
# pivot_longer(-iid) %>%
# mutate(sweep = str_sub(name, -2) %>% as.integer(),
# observed = ifelse(value %in% 1, 1, 0)) %>%
# select(iid, sweep, observed)
#
# ## d. NCDS ----
# ncds <- list()
#
# ncds$sample <- df_file %>%
# filter(study == "ncds",
# variable == "MULTIPNO") %$%
# load_bcs70(file_path) %>%
# mutate(iid = row_number()) %>%
# select(ncdsid, iid)
#
# ncds$attrit <- df_file %>%
# filter(study == "ncds",
# variable == "MULTIPNO") %$%
# load_bcs70(file_path) %>%
# left_join(ncds$sample, by = "ncdsid") %>%
# select(iid, matches("outcme")) %>%
# pivot_longer(-iid) %>%
# mutate(sweep = str_sub(name, -2) %>% as.integer(),
# sweep = case_when(sweep <= 6 ~ sweep + 1,
# sweep >= 7 ~ sweep + 2,
# is.na(sweep) ~ 8),
# observed = ifelse(value %in% 1, 1, 0)) %>%
# select(iid, sweep, observed)
#
#

0 comments on commit a2333d3

Please sign in to comment.