I have a list of lists with the following structure:
fruit
-apple
--ID = 1
---condition = good
---colour = green
--ID = 2
---condition = bad
---colour = red
--ID = 3
---condition = okay
--- colour = red
-banana
--ID = 4
---condition = bad
---colour = yellow
---peel = TRUE
--ID = 5
---condition = bad
---colour = yellow
---peel = TRUE
--ID = 6
---condition = good
---colour = yellow
---peel = FALSE
-peach
--ID = 7
---colour = orange
--ID = 8
---colour = orange
--ID = 9
---colour = orange
is there a way to extract a vector of the colours? ie, "green" "red" "red" "yellow" ....
It is possible to grab them for a single fruit by:
apply(fruit$apple, '[[', "colour")
but I do not know how to grab through all fruit without looping through the names?
thanks in advance for the help!