飞天玄舞6 发表于 2016-11-13 15:18 
没问题啊,你把程序贴出来
> dat<-read.table("A",header=T)
> group<-dat[,1]
> dat
group V
1 A01 B01
2 A01 B02
3 A01 B03
4 A02 B01
5 A02 B04
6 A03 B02
7 A04 B05
> aggregate(data=dat,V~factor(group),FUN=function(x) list(x))
factor(group) V
1 A01 1, 2, 3
2 A02 1, 4
3 A03 2
4 A04 5