This is a basic question. I want to rearrange a table like this:

```
A    1
B    2
B    3
B    4
C    5
C    6
```

to: 

```
A    1
B    2,3,4
C    5,6
```

Could anyone gives a hint. Either with R or python?
How about with bedtools:

    $ cat t.txt
    A    1
    B    2
    B    3
    B    4
    C    5
    C    6

    $ bedtools groupby -i t.txt -g 1 -c 2 -o collapse
    A    1
    B    2,3,4
    C    5,6