Skip to content

Commit

Permalink
Add household smoker number lag
Browse files Browse the repository at this point in the history
Removed additional message showing in package
  • Loading branch information
rkailechen committed Sep 6, 2023
1 parent a7b62aa commit 17daaf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/ukhls_combine_hhold_smokers.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ukhls_combine_hhold_smokers <- function(data = NULL) {
hhold <- hhold[, `NA` := NULL]
hhold <- hhold[, non_smoker := NULL]
hhold <- hhold[, smoker := NULL]
data <- merge(data, hhold, by = "hidp")
data <- suppressWarnings(suppressMessages(merge(data, hhold, by = "hidp")))

return(data)
}
4 changes: 4 additions & 0 deletions R/ukhlsclean.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ data <- ukhlsclean::ukhls_combine_waves(data_list)
### Summation of smokers in household
data <- ukhls_combine_hhold_smokers(data)

#####################################
### Lag household smokers to (t-1)
data <- data[order(pidp, wave_no), lag.s_hhold_smokers := data.table::shift(s_hhold_smokers, n=1, type="lag"), by=pidp]

###################################
### Combine youth data

Expand Down

0 comments on commit 17daaf9

Please sign in to comment.