Skip to content

Commit

Permalink
Test remove wave 3+4
Browse files Browse the repository at this point in the history
  • Loading branch information
rkailechen committed May 5, 2023
1 parent 4a70ad2 commit 432bf04
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions R/ukhls_clean_smoke.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##
Expand Down

0 comments on commit 432bf04

Please sign in to comment.