Hello, Please send your questions to r-help at r-project.org, the odds of you getting more and better answers are greater. And, why don't you use ?dput to post your data? As for your question, it seems that ?aggregate solves the problem. dat <- read.table(text = " ua ELM PRP 122C MO 5 122C BR 3 122C FA 1 122C MO 1 122D BR 7 122D MO 2 122D BR 1 ", header = TRUE) aggregate(PRP ~ ua + ELM, data = dat, FUN = sum) Hope this helps, Rui Barradas Em 11-03-2014 10:11, catalin roibu escreveu:> Dear Rui, > > I have a new problem with R. How can I do this summarize the ELM PRP for > each ua. > My data is like this: > > ua ELM PRP > 122C MO 5 > 122C BR 3 > 122C FA 1 > 122C MO 1 > 122D BR 7 > 122D MO 2 > 122D BR 1 > > > and I want to obtain something like this: > > ua ELM PRP > 122C MO 6 > 122C BR 3 > 122C FA 1 > 122D BR 8 > 122D MO 2 > > > Thank you very much! > > -- > --- > Catalin-Constantin ROIBU > Lecturer PhD, Forestry engineer > Forestry Faculty of Suceava > Str. Universitatii no. 13, Suceava, 720229, Romania > office phone +4 0230 52 29 78, ext. 531 > mobile phone +4 0745 53 18 01 > +4 0766 71 76 58 > FAX: +4 0230 52 16 64 > silvic.usv.ro <http://silvic.usv.ro>