| getperc | R Documentation |
Get percentage of a value
getperc(data, var, val)
data |
A dataframe |
var |
A variable in the dataframe, written as a character in quotes, e.g. "var" |
val |
A value of variable var of which to get the percentage, also in quotes |
Returns the percentage of value val in relation to all values of var
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.