Skip to content

Instantly share code, notes, and snippets.

@rpietro
Created July 8, 2013 22:34
Show Gist options
  • Save rpietro/5953071 to your computer and use it in GitHub Desktop.
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
```{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