#' PercentFunction
#'
#' This function calculates the percentages for dataframe columns
#' @keywords percent
#' @param data a dataframe
#' @param ... dataframe columns
#' @export
#' @examples
#' percent()
percent = function(data, ...){
{
argList = match.call(expand.dots = FALSE)$...
cat(paste("_________________________________________", "\n"))
for(i in 1:length(argList)){
colName = argList[[i]]
output = eval(substitute(colName), envir = data, enclos = parent.frame())
cat(colName,":", "\n", "\n")
t = (table(output) / nrow(data)) * 100
print(t)
}
}
}
#document()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.