Statistical Summaries
Quantiles
Cut Points in a Vector
quantile reports values at requested probabilities, such as the middle or quartile cut points.
Program
Play the script to choose a probability and read the matching score cut point.
quantiles.R
scores <- c(4, 7, 9, 10, 12)
percent <-
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
scores <- c(4, 7, 9, 10, 12)
percent <-
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
scores <- c(4, 7, 9, 10, 12)
percent <-
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
quantile
`quantile(scores, percent)` returns the cut point for a probability.
as.numeric
`as.numeric` strips names from the quantile result for simple output.
probability
`0.50` asks for the median; `0.25` and `0.75` ask for quartiles.