Plotting opportunity cost
Again, interest is in whether the treatment and control groups were equally likely to buy a DVD after reading the experimental statements. Here, you'll create a barplot to visualize the difference in proportions between the treatment and control groups.
Latihan ini adalah bagian dari kursus
Foundations of Inference in R
Petunjuk latihan
- Using the
opportunitydataset, plotgroupfilled bydecision. - Call
geom_bar()to add a bar plot layer, setting the position argument to"fill"to compare relative frequencies. Note that fill should be defined by thedecisionfor each group.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Plot group, filled by decision
ggplot(opportunity, aes(x = ___, fill = ___)) +
# Add a bar layer, with position "fill"
___