you can do this: a <- tapply(VAR, YEAR, prod)
The use "merge" to create a new variable of the length of your original VAR, and just do VAR/prod.VAR ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Mon, Apr 26, 2010 at 6:07 PM, n.via...@libero.it <n.via...@libero.it>wrote: > PROD [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.