Created
July 8, 2013 22:34
-
-
Save rpietro/5953071 to your computer and use it in GitHub Desktop.
Rmarkdown chunk to calculate percentage. simple but very useful when putting multimarkdown tables inside Rmarkdown
This file contains 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
```{r echo=FALSE, error=TRUE} | |
perc <- function(var){ | |
result <- 100*(table(var))/sum(table(var)) | |
return(result) | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment