I do have the following simple example of a nested list:
list(list(structure(list(group = "a", def = "control"), .Names = c("group",
"def"))), list(structure(list(group = "b", def = "disease1"), .Names = c("group",
"def"))))
The structure is as follows:
str(t1)
List of 2
$ :List of 1
..$ :List of 2
.. ..$ group: chr "a"
.. ..$ def : chr "control"
$ :List of 1
..$ :List of 2
.. ..$ group: chr "b"
.. ..$ def : chr "disease1"
Is there an easy way of getting only the nested list that satisfies a specific condition. As an example, if I knew only the name of the group, e.g., "a", how would I get the according sublist; in the example, this would be the first nested list:
[[1]]
[[1]]$group
[1] "a"
[[1]]$def
[1] "control"
So essentially I am looking for a way to apply group == "a"
in this nested list structure.