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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -