Learn R Programming

aihuman (version 1.0.0)

PlotStackedBar: Stacked barplot for the distribution of the decision given psa

Description

See Figure 1 for example.

Usage

PlotStackedBar(
  data,
  fta.label = "FTAScore",
  nca.label = "NCAScore",
  nvca.label = "NVCAFlag",
  d.colors = c("grey60", "grey30", "grey10"),
  d.labels = c("signature bond", "small cash bond", "large cash bond"),
  legend.position = "none"
)

Value

A list of three ggplots.

Arguments

data

A data.frame of which columns includes an ordinal decision (D), and psa variables (fta, nca, and nvca).

fta.label

Column name of fta score in the data. The default is "FTAScore".

nca.label

Column name of nca score in the data. The default is "NCAScore".

nvca.label

Column name of nvca score in the data. The default is "NVCAFlag".

d.colors

The color of each decision.

d.labels

The label of each decision.

legend.position

The position of legend. The default is "none".

Examples

Run this code
data(psa_synth)
# Control group (PSA not provided)
PlotStackedBar(psa_synth[psa_synth$Z == 0, ], d.colors = c(
  "grey80", "grey60",
  "grey30", "grey10"
), d.labels = c(
  "signature", "small",
  "middle", "large"
))
# Treated group (PSA provided)
PlotStackedBar(psa_synth[psa_synth$Z == 0, ], d.colors = c(
  "grey80", "grey60",
  "grey30", "grey10"
), d.labels = c(
  "signature", "small",
  "middle", "large"
))

Run the code above in your browser using DataLab