% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utility.R
\name{getperc}
\alias{getperc}
\title{Get percentage of a value}
\usage{
getperc(data, var, val)
}
\arguments{
\item{data}{A dataframe}

\item{var}{A variable in the dataframe, written as a character in quotes, e.g. "var"}

\item{val}{A value of variable var of which to get the percentage, also in quotes}
}
\value{
Returns the percentage of value \code{val} in relation to all values of \code{var}
}
\description{
Get percentage of a value
}
\examples{
 getperc(data.frame(a = c("duck", "duck", "goose")),
  "a", 
  "duck")
 
 # Also works when val is indexed (alphabetically)
 getperc(data.frame(a = c("duck", "duck", "goose")),
  "a", 
  2)

}
