x0=rnorm(100)
y0=rpois(100,3)+1

ind=as.data.frame(table(y0))

ind1=ind[,1]
ind2=ind[,2]

phi=NULL
for (i in 1:length(ind2)){
   phi[i]=sum(x0[y0==ind1[i]])/ind2[i]
}

	[[alternative HTML version deleted]]

