#' Return the percentage of instances of a certain variable based on another.
#'
#' @param x a data frame.
#' @param y the column of the data frame to filter by.
#' @param b the variable being filtered by.
#' @param z the column of the data frame to search.
#' @param a the variable being tested.
#' @return A vector made up of percentage values of the instances of a certain variable. \code{y}.
#' @examples
#' varRequest(x, y, b, z, a)
#' @export
varRequest <- function(x, y, b, z, a){
sub <- x[y == b,]
sub2 <- sub[sub$z == a]
percent <- nrow(sub2)/nrow(mtcars)
percent <- percent * 100
return(percent)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.