I have the R code for Fisher's exact test, however, I it's a bit too much and I am getting bogged down trying to read through the code.

My objective is to calculate the test for a 2x2 table, but I am a bit confused as to where to begin...

I understand that I should first write a hypergeometic function to calculate the initial p value of the given table, but I am confused how to create the marginal frequency tables...

Thank you

ps. apophenia won't install :-(