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.

percent
quantiles.R
Replay: real traced execution (multi-file project)
scores <- c(4, 7, 9, 10, 12)
percent <- 0.50
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
scores <- c(4, 7, 9, 10, 12)
percent <- 0.25
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
scores <- c(4, 7, 9, 10, 12)
percent <- 0.75
cutoff <- as.numeric(quantile(scores, percent))
cat(cutoff, "\n", sep = "")
  1. scores ← 4, 7, 9, 10, 12

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.50
    values this step4, 7, 9, 10, 12scores
  2. percent ← 0.50

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.503cutoff <- as.numeric(quantile(scores, percent))
    values this step0.50percent
  3. cutoff ← 9

    2percent <- 0.503cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    values this step9cutoff4, 7, 9, 10, 12scores0.50percent
  4. cat(cutoff, " ", sep = "")

    3cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    output9
    values this step9cutoff
  1. scores ← 4, 7, 9, 10, 12

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.25
    values this step4, 7, 9, 10, 12scores
  2. percent ← 0.25

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.253cutoff <- as.numeric(quantile(scores, percent))
    values this step0.25percent
  3. cutoff ← 7

    2percent <- 0.253cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    values this step7cutoff4, 7, 9, 10, 12scores0.25percent
  4. cat(cutoff, " ", sep = "")

    3cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    output7
    values this step7cutoff
  1. scores ← 4, 7, 9, 10, 12

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.75
    values this step4, 7, 9, 10, 12scores
  2. percent ← 0.75

    1scores <- c(4, 7, 9, 10, 12)2percent <- 0.753cutoff <- as.numeric(quantile(scores, percent))
    values this step0.75percent
  3. cutoff ← 10

    2percent <- 0.753cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    values this step10cutoff4, 7, 9, 10, 12scores0.75percent
  4. cat(cutoff, " ", sep = "")

    3cutoff <- as.numeric(quantile(scores, percent))4cat(cutoff, "\n", sep = "")
    output10
    values this step10cutoff
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.