Skip to content

Commit

Permalink
fix error when not hgt/wgt/bmi data available
Browse files Browse the repository at this point in the history
  • Loading branch information
iriseekhout committed Jan 15, 2024
1 parent 2828e1f commit c713cf6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/collect_predictors.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ collect_predictors <- function(tgt = NULL, outcome = "overweight-4y", purpose =
right_join(data.frame(vtime, vname), by = c("gp"="vtime")) |>
ungroup()

if(!hasName(tvl, "hgt")){tvl$hgt <- NA}
if(!hasName(tvl, "wgt")){tvl$wgt <- NA}
if(!hasName(tvl, "bmi")){tvl$bmi <- NA}


tpred <- c("ddicmm041", "ddicmm042", "bds823", "bds816")

Expand All @@ -251,7 +255,7 @@ collect_predictors <- function(tgt = NULL, outcome = "overweight-4y", purpose =
.data$yname %in% !!tpred) |>
group_by(.data$yname) |> dplyr::slice_tail(n = 1)|> #als meerderen metingen, laatste nemen voor elke variabele.
pivot_wider(names_from = "yname", values_from = "y") |>
select(-.data$age)
select(-"age")


p <- tgt$psn
Expand Down

0 comments on commit c713cf6

Please sign in to comment.