Using a LOT of time on fiddling together tables of descriptive statistics manually in R did not inspire me to look in the CRAN repositories for a R function doing exactly this… yes a bit stubborn… want to find out myself…
So what I had to do was:
- handcode the descriptives for each variable, something like
prop.table(xtabs( ~ Variable + Group1 + Group2), c(2,3)),
- calculate some statistics for each variable (chi^2, one-way-ANOVA, Fisher-exact..) and attach it to the descriptives,
- run the code,
- copy the plain text output from R back into the editor and finally
- add LaTeX or CSV syntax to get the desired results.
Anyway this is over now. A solution exists, of course (thx Kjetil… again):
The package ‘reporttools’ of Kaspar Rufibach.
The most important functions are well:
tableContinuous( vars = c(bmi, ejectionfraction, systolicBP, diastolicBP) , group = sex , subset = significantstenosis , print.pval = "anova")
tableNominal() for nominal variables.
The output is LaTeX and it is possible to specify table captions and lables to the tables in the function call. I will give it a try inside Sweave… but first I have to get it to my Linux machine … which is blocked by the corporate firewall … after a recent Mircrosoft powergrab … after a Virusattack (Conficker) … after running XP unpached.
But thats another story