Extract data from list of lists [R]
问题 I have a list of lists (mydata$notes) that I want to extract data from. Code looks like this, if I want to extract "location" - this works fine. location <- unlist (lapply(mydata$notes, function(e) e$location)) Now, I might have more variables I want to extract, say a vector of 20, "location", "var1", "var2", "var3" and so on, in an atomic vector names(unlist(mytree$notes[[1]])) How can I loop my first code to extract all variables given in this names-variable? Cheers 回答1: Define a vector to