Skip to contents

Rename features in a data_list

Usage

rename_dl(data_list, name_mapping)

Arguments

data_list

A nested list of input data from generate_data_list().

name_mapping

A named vector where the values are the features to be renamed and the names are the new names for those features.

Examples


library(metasnf)

data_list <- generate_data_list(
    list(pubertal, "pubertal_status", "demographics", "continuous"),
    list(anxiety, "anxiety", "behaviour", "ordinal"),
    list(depress, "depressed", "behaviour", "ordinal"),
    uid = "unique_id"
)
#> Warning: 120 subject(s) dropped due to incomplete data.

summarize_dl(data_list, "feature")
#>              name       type       domain
#> 1 pubertal_status continuous demographics
#> 2  cbcl_anxiety_r    ordinal    behaviour
#> 3  cbcl_depress_r    ordinal    behaviour

name_changes <- c(
    "anxiety_score" = "cbcl_anxiety_r",
    "depression_score" = "cbcl_depress_r"
)

data_list <- rename_dl(data_list, name_changes)

summarize_dl(data_list, "feature")
#>               name       type       domain
#> 1  pubertal_status continuous demographics
#> 2    anxiety_score    ordinal    behaviour
#> 3 depression_score    ordinal    behaviour