Hi,
I have a data frame with several factors and I want to count the occurrences
of an event resulting from an interaction of some factors.
I tried to do several tables (and then converting to d.f and then merge them
by one factor and the freq

Tab1 <- merge (BPorAmost,BPorSector,by=c('Sample','Freq'))
Tab1 <- merge (Tab1,BPorDist,by=c('Sample','Freq'))
Tab1 <- merge (Tab1,BPorProf,by=c('Sample','Freq'))

But I have lots of NAs because I can have a interaction between sample and
freq different for each factor: to the same sample and the same freq I can
have 2 or more different factors. And also I don't need those lots of zeros.
I'd only need a table as excell does with pivot table and summarize data as
count.

I also tried to make an aggregation:
e.g.
F.Aggregate.DFrame(df [,2],df[,c(1,3,4)],length)
but it doesn't work with length - results are all 1.

Do you have some suggestions? I'd really like to learn doing it in R and not
having to shift to excell!

Thanks a lot,
Cheers,
Barbara

-- 
Bárbara H. Costa
Marine Biologist Researcher
SCIAENA - Marine Sciences and Cooperation
www.sciaena.org

ISPA | http://www.ispa.pt/ui/uie/index.asp
BIOMARES | http://www.ccmar.ualg.pt/biomares/
MSI-UCSB | http://www.msi.ucsb.edu/

bco...@ispa.pt
barbarahco...@gmail.com

        [[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.

Reply via email to