Re: [R] Formula in a data-frame

2012-09-18 Thread arun
Vi<-new2$Volume.y/new2$Volume.x res<-new1[,5]*new2[,5]/sum(new1[,5]*new2[,5]) res #[1] 0.004169822 0.008339644 0.070886971 0.291887526 0.002776516 0.599727397 #[7] 0.022212126 A.K. - Original Message - From: Raoni Rodrigues To: r-help@r-project.org Cc: Sent: Tuesday, September 18, 201

Re: [R] Formula in a data-frame

2012-09-18 Thread Rui Barradas
Hello, 1) Instead of computing TFrequency and TVolume like you have, try the following. TF <- with(Frequency, ave(Frequency, Specie, FUN = sum)) TV <- with(Volume, ave(Volume, Specie, FUN = sum)) Fi <- with(Frequency, Frequency/TF) Vi <- with(Volume, Volume/TV) Importance <- Fi*Vi/sum(Fi*Vi)

[R] Formula in a data-frame

2012-09-17 Thread Raoni Rodrigues
Hello all, I'm new in R, and I have a data-frame like this (dput information below): Specie Fooditem Occurrence Volume 1 Schizodonvegetal 1 0.05 2 Schizodon sediment 1 0.60 3 Schizodonvegetal 1 0.15 4 Schizodon