Given the following unequal list :
lst <- list("es1-7"= c(1,2,3,4), "sa1-12"=c(3,4) , "ES8-13"= c(9,7,4,1,5,2))
> lst
$`es1-7`
[1] 1 2 3 4
$`sa1-12`
[1] 3 4
$`ES8-13`
[1] 9 7 4 1 5 2
I would like to create a data-frame like this:
group numbers
1 es1-7 1
2 es1-7 2
3 es1-7 3
4 es1-7 4
5 sa1-12 3
6 ... ...
So in this case names
of the list will be values of a new column called group
and numbers
will be the values of the list.
Solutions using base
and dplyr
are more than welcome