Is there a best way to extract the lower elements of a list?
For example this list people has a series of "peoples", each with a number "R" attached as people[[i]]$Expertise$R
.
Is there a best way to extract them as a vector?
I hoped to use rlist and its good for loads of things I needed but I can't see a function for this.
Here is an example doing what I need but maybe suboptimally:
#https://renkun.me/rlist-tutorial/Features/Filtering.html
#install.packages("rlist")
library(rlist)
people <- list.load("http://renkun.me/rlist-tutorial/data/sample.json")
length(people)
str(people)
people[[1]][[1]]$R
str(list.filter(people, Age >= 25))
Rskill<-numeric()
for(i in 1:length(people))
Rskill<-c(Rskill,people[[i]]$Expertise$R)
Rskill
unlist(lapply(1:length(people),function(i) people[[i]]$Expertise$R))