I have a data frame with a number of infections identified from clinical isolates at different dates.
So far I have organised the data into a shape that I want to start working with. I am trying to prepare a series of tables of tables for the descriptive statistics of the report.
I have been using ftable
and get the following:
onset.types <- ftable(SAB$Onset,SAB$MRSA.Type,year(SAB$Collection.Date))
2005 2006 2007 2008 2009 2010
Community 454 472 512 499 525 512
AUS-2/3-like 28 23 27 29 32 38
EMRSA-15-like 9 4 4 9 8 8
nmMRSA 40 47 53 39 64 60
Other mMRSA 1 3 3 11 5 9
unclassified MRSA 0 2 0 0 1 1
Hospital 163 163 156 164 149 165
AUS-2/3-like 31 33 27 31 29 28
EMRSA-15-like 3 8 5 9 4 3
nmMRSA 10 9 13 17 13 12
Other mMRSA 5 1 6 2 3 10
unclassified MRSA 2 0 1 0 0 0
Two questions:
1: How would I calculate marginal totals
2: Is there an easy way to calculate percentages as well as counts again with marginal totals
I have tried epitools and I did not find it as useful as I would have liked.
Many thanks.