dictionary - R fastest way to get values from list as vector -


this question has answer here:

in r, give list

l1 <- list(a = "a", b = "b", c = "c") 

and vector

v<- c("a", "c") 

how elements list in vector? example

l1[v]  

returns list, while need vector as

c("a", "c") 

looking fastest one-liner.

you can try this, similar @colonelbeauvel

identical(as.vector(unlist(l1[v])), c("a", "c")) [1] true 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -