For a smaller data frame, decodes the columns that have a list of values.

decode_multi_purrr(cohort, coding)

Arguments

cohort
  • cohort or dataset in data.frame format

coding

Value

Labeled data frame where multi category columns are decoded

Details

For a larger data frame, such as from UK Biobank, we recommend you use decode_multi_large_df(), which will split your data frame into smaller ones for decoding.

Examples

data(coding_dict)
data(cohort)
data(data_dict)

cdata <- merge_coding_data_dict(coding_dict, data_dict)

cohort |>
  decode_multi_purrr(cdata)
#> # A tibble: 100 × 18
#>    participant.p21022 participant.p100240_i0 participant.p100240_i1
#>                 <dbl>                  <dbl>                  <dbl>
#>  1                 43                     NA                      1
#>  2                 60                     NA                     NA
#>  3                 53                     NA                      0
#>  4                 62                     NA                     NA
#>  5                 67                     NA                     NA
#>  6                 61                     NA                     NA
#>  7                 66                     NA                     NA
#>  8                 56                     NA                     NA
#>  9                 55                     NA                     NA
#> 10                 53                     NA                     NA
#> # ℹ 90 more rows
#> # ℹ 15 more variables: participant.p100240_i2 <dbl>,
#> #   participant.p100240_i3 <dbl>, participant.p100240_i4 <dbl>,
#> #   participant.p1498_i0 <dbl>, participant.p1498_i1 <dbl>,
#> #   participant.p1498_i2 <dbl>, participant.p1508_i0 <dbl>,
#> #   participant.p1508_i1 <dbl>, participant.p1508_i2 <dbl>,
#> #   participant.p41202 <chr>, participant.p31 <dbl>, …