This function enables manipulating a data_list
class object with lapply
syntax without removing that object's data_list
class attribute. The
function will only preserve this attribute if the result of the apply call
has a valid data list structure.
Value
If FUN applied to each component of X yields a valid data list, a data list. Otherwise, a list.
Examples
# Convert all UID values to lowercase
dl <- data_list(
list(abcd_income, "income", "demographics", "discrete"),
list(abcd_colour, "colour", "likes", "categorical"),
uid = "patient"
)
#> ℹ 49 observations dropped due to incomplete data.
dl_lower <- dlapply(
dl,
function(x) {
x$"data"$"uid" <- tolower(x$"data"$"uid")
return(x)
}
)