Let's say I have a list like this:
x = list(list(1,2), list(3,4), list(5,6))
I would like a list that contains only the first elements of the nested list. I can do this by returning another list like so
x1 = lapply(x, function(l) l[[1]])
Is there shortcut notation for this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…