View source: R/relative_frequency.R
relative_frequency | R Documentation |
This function calculates the relative frequency of a value in a numeric vector.
relative_frequency(v = NULL, x = NULL, learn = FALSE, interactive = FALSE)
v |
Optional numeric vector (not needed for interactive mode) |
x |
Optional numeric value to count (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The relative frequency of x in v (for non-interactive mode)
data <- c(1,4,3,3,2,5,7,12,1,2,3,12)
value <- 12
# Simple calculation
relative_frequency(data, value)
# Learning mode
relative_frequency(data, value, learn = TRUE)
# Interactive mode
if(interactive()){
relative_frequency(interactive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.