Thank you for reminding me. ###### food=c('fruit','fruit','fruit','drink','drink','drink') type=c('apple','apple','orange','water','soda','soda') value=c(2,3,1,5,7,6) data=data.frame(food,type,value) share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18) market_con=c(rep(0.8333333^2+0.1666667^2,3),rep(0.2777778^2+0.7222222^2,3)) data$market_con=market_con ######
Share= sum of value for specific type for some food / sum of value for all types for some food concentration= sum of square of share For food 1, fruit, for apple ,there are two rows, value =2 and 3; for oranget, value =1. share_apple=(2+3)/(2+3+1)=5/6 ## It is the same for the two rows share_organge=1/6 concentration_fruit= share_apple^2+sjare_orange^2=(5/6)^2+(1/6)^2 Hope this makes it easier to understand. Thanks Yi On Wed, Aug 11, 2010 at 3:33 PM, Wu Gong <w...@mtmail.mtsu.edu> wrote: > > Hi Yi, > > It would be helpful for others to provide a solution if you give your > formulas that calculating the value of share and concentration. > > ?apply will helps. > > Regards, > > Wu > > > > ----- > A R learner. > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-calculate-the-concentration-tp2321888p2321966.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > [[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.