0

Is there a base function to transform a named vector (with some repeated labels) into a list with each entry being on of the labels instead of using this combination ? MWE:

> v = 1:10
> names(v) = sample(letters[1:5], 10, replace = T)
> lapply(lapply(split(as.list(v), names(v)), unlist), unname)
$c
[1] 4 5 9

$d
[1] 2 3 6 7 8

$e
[1]  1 10
ClementWalter
  • 4,814
  • 1
  • 32
  • 54
  • `split(unname(v), names(v))` is I guess already much better than my formula ! – ClementWalter Apr 14 '16 at 11:23
  • 2
    [This](http://stackoverflow.com/questions/9713294/split-data-frame-based-on-levels-of-a-factor-into-new-data-frames) is probably a better dupe. You could close this yourself if you feel like it's good enough – David Arenburg Apr 14 '16 at 11:25

0 Answers0