data(MktDATA, package = "UBStats")
# Means (and their CI) or medians by a single variable
# - Barplot of means (default) by a character
summaries.plot.x(x = TotVal, stats = "mean",
by1 = Gender, data = MktDATA)
# - Barplot of medians by a numerical variable
# classified into intervals: user-defined color
summaries.plot.x(x = TotVal, stats = "median",
by1 = AOV, breaks.by1 = 5,
color = "purple", data = MktDATA)
# - Lineplot of means and their CI by a variable
# measured in classes
summaries.plot.x(x = TotVal,
stats = "ci.mean", plot.type = "lines",
by1 = Income.S, interval.by1 = TRUE,
data = MktDATA)
# - Barplot of means and their CI by a
# numerical variable; change the confidence level
summaries.plot.x(x = TotVal,
stats = "ci.mean", conf.level = 0.90,
plot.type = "bars",
by1 = NWeb_Purch, data = MktDATA)
# - Note: no plot built for a variable with
# too many levels (>20)
# summaries.plot.x(x = TotVal,
# stats = "ci.mean", plot.type = "lines",
# by1 = AOV, data = MktDATA)
# Quantiles by a single variable
# - Only lines plots allowed for quantiles
summaries.plot.x(x = Baseline,
stats = "deciles", plot.type = "lines",
by1 = NDeals, data = MktDATA)
summaries.plot.x(x = Baseline,
stats = "quartiles", plot.type = "lines",
by1 = Marital_Status, data = MktDATA)
# Means and medians by two variables
# - Default: only lines allowed
summaries.plot.x(x = TotVal, stats = "mean",
by1 = Education, by2 = Kids,
data = MktDATA)
summaries.plot.x(x = TotVal, stats = "median",
by1 = Income.S, by2 = Gender,
interval.by1 = TRUE,
data = MktDATA)
summaries.plot.x(x = Baseline, stats = "mean",
by1 = CustClass, by2 = AOV,
breaks.by2 = 5, data = MktDATA)
# - "ci.mean" not allowed with two layers
CustClass_Kids<-paste0(MktDATA$CustClass,"-",MktDATA$Kids)
summaries.plot.x(x = Baseline, stats = "ci.mean",
conf.level = 0.99, by1 = CustClass_Kids,
color = "gold", data = MktDATA)
# Arguments adj.breaks and use.scientific
# Variables with a very wide range
LargeX<-MktDATA$TotVal*1000000
LargeBY<-MktDATA$AOV*5000000
# - Default: no scientific notation
summaries.plot.x(LargeX, plot.type = "bars",
by1=LargeBY, breaks.by1 = 5, data = MktDATA)
# - Scientific notation for summaries (axes)
summaries.plot.x(LargeX, plot.type = "lines",
by1=LargeBY, breaks.by1 = 5,
use.scientific = TRUE, data = MktDATA)
# - Scientific notation for intervals endpoints
summaries.plot.x(LargeX, stats = "ci.mean",
plot.type = "lines",
by1=LargeBY, breaks.by1 = 5,
adj.breaks = FALSE, data = MktDATA)
# - Scientific notation for intervals endpoints and summaries
summaries.plot.x(LargeX, stats = "quartiles",
plot.type = "lines",
by1=LargeBY, breaks.by1 = 5,
adj.breaks = FALSE, use.scientific = TRUE,
data = MktDATA)
# Output the table with the requested summaries
Out_TotVal<-summaries.plot.x(x = TotVal, stats = "ci.mean",
by1 = Education, data = MktDATA)
Run the code above in your browser using DataLab