Created
December 30, 2015 16:58
-
-
Save dmarcelinobr/209697e1f1bfc2f19abc to your computer and use it in GitHub Desktop.
Test 2: Extend pander to also work with CrossTable R objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pander.CrossTable <- function(x, ...) { | |
| pandoc.table(x$t, caption = 'Observed Count') | |
| pandoc.table(x$prop.row, caption = 'Row percentages') | |
| pandoc.table(x$prop.col, caption = 'Column percentages') | |
| emphasize.strong.cells (which(x$chisq$residuals > 2,arr.ind=T)) | |
| emphasize.strong.cells (which(x$chisq$residuals < -2,arr.ind=T)) | |
| pandoc.table(x$chisq$residuals, caption = 'Residuals of the Chi-sqaured test') | |
| paste(c('P-value of the Chi-squared test:',round(x$chisq$p.value,3))) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment