From 432bf044e9f3fa7f6749f37a582d3bf46b4872f2 Mon Sep 17 00:00:00 2001 From: Ryan Kai Le Chen Date: Fri, 5 May 2023 14:26:48 +0100 Subject: [PATCH] Test remove wave 3+4 --- R/ukhls_clean_smoke.R | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/R/ukhls_clean_smoke.R b/R/ukhls_clean_smoke.R index 580a6a1..24187f4 100644 --- a/R/ukhls_clean_smoke.R +++ b/R/ukhls_clean_smoke.R @@ -34,15 +34,17 @@ ukhls_clean_smoke <- function(data = NULL) { ########################################### #### Wave 3 and 4, current smoker status ## - - if("smoke_freq" %in% colnames(data)) { - - data[wave_no %in% c(3,4) & (smoke_freq == 4 | smoke_freq == 5), current_smoker := "smoker"] - data[wave_no %in% c(3,4) & ! (smoke_freq == 4 | smoke_freq == 5), current_smoker := "non_smoker"] - data[wave_no %in% c(3,4) & is.na(smoke_freq), current_smoker := NA] - - ### Cannot do ever_smoked because no way of determining if they have never smoked before on a wave-by-wave basis - } +# +# if("smoke_freq" %in% colnames(data)) { +# +# data[wave_no %in% c(3,4) & (smoke_freq == 4 | smoke_freq == 5), current_smoker := "smoker"] +# data[wave_no %in% c(3,4) & ! (smoke_freq == 4 | smoke_freq == 5), current_smoker := "non_smoker"] +# data[wave_no %in% c(3,4) & is.na(smoke_freq), current_smoker := NA] +# +# ### Cannot do ever_smoked because no way of determining if they have never smoked before on a wave-by-wave basis +# } + + ### Dropped because waves 3 and 4 only include responses age cat 16-21 ########################################### ##### Waves 6 - 11 current smoker status ##