# Basics:
# (1) Using global prob and freq values:
plot_bar()
# (2) Providing values:
plot_bar(prev = .33, sens = .75, spec = .66, main = "Test 1")
plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, main = "Test 2") # by "all" (default)
# (3) Rounding and sampling:
plot_bar(N = 100, prev = 1/3, sens = 2/3, spec = 6/7, area = "hr", round = FALSE)
plot_bar(N = 100, prev = 1/3, sens = 2/3, spec = 6/7, area = "hr", sample = TRUE, scale = "freq")
# Perspectives (by):
# plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "cd",
# main = "Test 3a") # by condition
plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "cd", dir = 2,
main = "Test 3b", f_lbl = "num") # bi-directional
# plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "dc",
# main = "Test 4a") # by decision
plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "dc", dir = 2,
main = "Test 4b", f_lbl = "num") # bi-directional
# plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "ac",
# main = "Test 5a") # by accuracy
plot_bar(N = 1000, prev = .33, sens = .75, spec = .60, by = "ac", dir = 2,
main = "Test 5b", f_lbl = "num") # bi-directional
# Customize colors and text:
plot_bar(dir = 1, f_lbl = "num", col_pal = pal_org)
# plot_bar(dir = 2, f_lbl = "nam", col_pal = pal_bw)
# Frequency labels (f_lbl):
# plot_bar(f_lbl = "def") # default labels: name = num
plot_bar(f_lbl = "nam") # name only
plot_bar(f_lbl = "num") # numeric value only
# plot_bar(f_lbl = "abb") # abbreviated name
# plot_bar(f_lbl = NA) # no labels (NA/NULL/"no")
# Scaling and rounding effects:
plot_bar(N = 3, prev = .1, sens = .7, spec = .6, dir = 2,
scale = "f", round = TRUE,
main = "Rounding (1)") # => Scale by freq and round freq.
plot_bar(N = 3, prev = .1, sens = .7, spec = .6, dir = 2,
scale = "p", round = TRUE,
main = "Rounding (2)") # => Scale by prob and round freq.
plot_bar(N = 3, prev = .1, sens = .7, spec = .6, dir = 2,
scale = "f", round = FALSE,
main = "Rounding (3)") # => Scale by freq and do NOT round freq.
plot_bar(N = 3, prev = .1, sens = .7, spec = .6, dir = 2,
scale = "p", round = FALSE,
main = "Rounding (4)") # => Scale by prob and do NOT round freq.
Run the code above in your browser using DataLab