How can I extract the set of (a) and set of (b) as shown in the image to two different vectors, the first vector for (a) values and the second for (b) values
CodePudding user response:
Using names
> tmp=c("a"=1,"b"=2,"a"=3,"b"=5)
> tmp[names(tmp)=="a"]
a a
1 3