On 6/10/07, gallon li <gallon.li at gmail.com> wrote: > Suppose I have a vector A=c(1,2,3) > > now I want to compare each element of A to another vector L=c(0.5, 1.2) > > and then recode values for sum(A>0.5) and sum(A>1.2) > > to get a result of (3,2) > > how can I get this without writing a loop of sums? How about colSums(outer(A, L, ">")) Hadley