Learn R Programming

fsbrain (version 0.1.0)

getIn: Retrieve values from nested named lists

Description

Retrieve values from nested named lists

Usage

getIn(named_list, listkeys)

Arguments

named_list

a named list

listkeys

vector of character strings, the nested names of the lists

Value

the value at the path through the lists, or NULL if no such path exists

Examples

Run this code
# NOT RUN {
   data = list("regions"=list("frontal"=list("thickness"=2.3, "area"=2345)));
   getIn(data, c("regions", "frontal", "thickness"));       # 2.3
   getIn(data, c("regions", "frontal", "nosuchentry"));     # NULL
   getIn(data, c("regions", "nosuchregion", "thickness"));  # NULL

# }

Run the code above in your browser using DataLab