"jim holtman" <[EMAIL PROTECTED]> writes:

> ?ave

Finally, someone remembered it!
 
> > cbind(x, ave(x$h.age, x$hhid))

>        hhid h.age ave(x$h.age, x$hhid)
> 1  10010020    23             23.00000
> 2  10010020    23             23.00000


Or, get rid of ugly colname using 

cbind(x, hhavg=ave(x$h.age, x$hhid))

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to