I have been trying to learn to use the summary()-function from the Hmisc-package to generate crosstables that include chisquared tests. With help from this board I'm almost there. I just can't figure out how to obtain row-percentages instead of column percentages.
#Data:
v1 <- sample(letters[8:12],200,replace=TRUE)
v2 <- sample(letters[1:2],200,replace=TRUE)
month <- sample(month.name[7:9],200,replace=TRUE)
df <- data.frame(v1,v2,month)
#Table:
latex( summary( month ~ v1 + v2 , data=df, method="reverse" ,test=TRUE), exclude1=FALSE,file="",booktabs=TRUE,long=TRUE)
Which gets me this:
This gets me the column-percentages. I am looking for a way to turn it around so i get the row-percentages instead. I've been searching the Hmisc-documentation for "row" and "column" and "percent" but no luck. The summary.formular() function has the optional argument "fun" but it is over my head to get it to do row percentages...
Please Help