For a given child, this script joins measurements made within a specified window.

make_wide(
  long,
  instruments = c("gpa", "gto", "by3"),
  days = 10L,
  drop_na_age = TRUE,
  include_return = FALSE,
  quiet = FALSE
)

Arguments

long

Long form data, typically created by scripts/edit_data.R

instruments

Character vector of instruments names. Currently supported instruments are `"gpa"`, `"gto"` and `"by3"`.

days

Non-negative integer, window width in number of days

drop_na_age

Logical. Should measurements with missing ages be dropped?

include_return

Logical. Should the return visits be included in the join?

quiet

Logical. Print messages to terminal?

Value

A data frame with one record per child. The first five columns are administrative variables, followed by the intervals in days per instrument. The remaining columns are items from the instruments.

Examples

if (FALSE) { # \dontrun{
joined <- make_wide(long, instruments = c("gpa", "gto"))
} # }