#' Return the percentage of instances of a given value.
#'
#' @param x a data frame column.
#' @param y a specificed observation.
#' @return The percentage of instances of a value. \code{y}.
#' @examples
#' colPercent(x,y)
#' @export
colPercent <- function(x,y){
lgth <- length(x)
count <- length(which(x == y))
count <- as.numeric(count)
per <- count / lgth
per <- per * 100
return(per)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.