Name lists after one of its elements
nameLists.RdA convenience function to organize information, mostly in YAML sequences.
Examples
### Create a test object
testObject <-
list(
list(elementId = "first",
someOther = "stuff"),
list(elementId = "second",
someOther = "stuff")
);
### Show it
testObject;
#> [[1]]
#> [[1]]$elementId
#> [1] "first"
#>
#> [[1]]$someOther
#> [1] "stuff"
#>
#>
#> [[2]]
#> [[2]]$elementId
#> [1] "second"
#>
#> [[2]]$someOther
#> [1] "stuff"
#>
#>
### Show the result of applying nameLists
clairvoyant::nameLists(
testObject,
"elementId"
);
#> $first
#> $first$elementId
#> [1] "first"
#>
#> $first$someOther
#> [1] "stuff"
#>
#>
#> $second
#> $second$elementId
#> [1] "second"
#>
#> $second$someOther
#> [1] "stuff"
#>
#>