# NOT RUN {
tmp <- data.frame(matrix(1:12, 3, 4,
dimnames=list(c("A","B","C"),
c(letters[4:7]))))
tmpcc <- cbind(tmp, rowheights=rowSums(tmp))
AAA <- likert(~ . , data=tmp, rightAxisLabels=tmpcc$rowheights,
main="The total width of each bar is the sum of its magnitudes.
The width of each sub-bar is its magnitude.
All bars have the same thickness.")
AAA
BBB <- likert(~ . , data=tmp, as.percent=TRUE, rightAxisLabels=tmpcc$rowheights,
main="The total width of each bar is 100
# }
# NOT RUN {
<!-- %. -->
# }
# NOT RUN {
The width of each sub-bar is its proportion of its row.
All bars have the same thickness.")
BBB
CCC <- likertWeighted(~ . | rowheights, tmpcc,
as.percent=TRUE, xlim=c(-100,100),
rightAxisLabels=tmpcc$rowheights,
main="The total width of each bar is 100
# }
# NOT RUN {
<!-- %. -->
# }
# NOT RUN {
The width of each sub-bar is its proportion of its row.
The thickness of each bar is the unique sum of its magnitudes.")
CCC
tmpdd <- cbind(tmp, rownames=row.names(tmp))
likertWeighted(~ . | rownames, tmpdd,
as.percent=TRUE, xlim=c(-100,100),
rightAxisLabels=tmpcc$rowheights,
main="Equal row thicknesses")
likertWeighted(~ . | rownames, tmpdd,
as.percent=TRUE, xlim=c(-100,100),
rightAxisLabels=tmpcc$rowheights,
h.resizePanels=rowSums(tmp),
main="Variable row thicknesses")
likertWeighted(~ . | rownames, tmpdd,
as.percent=TRUE, xlim=c(-100,100),
rightAxisLabels=c(1,3,3),
h.resizePanels=c(1,3,3),
ylab.right="Thicknesses Explicitly Specified",
main="Variable row thicknesses, with some duplication")
DDD <-
likertWeighted(~ . | rownames, tmpdd,
as.percent=TRUE, xlim=c(-100,100),
rightAxisLabels=paste(tmpcc$rowheights, c(1,3,3), sep=", "),
ylab.right="RowCount Total\nThicknesses Explicitly Specified",
h.resizePanels=c(1,3,3),
main="The total width of each bar is 100
# }
# NOT RUN {
<!-- %. -->
# }
# NOT RUN {
The width of each sub-bar is its proportion of its row.
The thickness of each bar is the value of h.resizePanels.")
DDD
## comparisons
AAA
BBB
CCC
DDD
EEE <-
likertWeighted(~ . | rownames, tmpdd,
as.percent=TRUE, xlim=c(-100,100),
h.resizePanels=rowSums(tmp),
rightAxisLabels=rowSums(tmp),
between=list(y=c(0,1)),
ylab=c("C in its own group","A and B together"),
main="Illustrating between: between=list(y=c(0,1))
Adjacent A and B with y.between = 0 are in the same bordered group.
Adjacent B and C with y.between != 0 are in different bordered groups.")
EEE
# }
Run the code above in your browser using DataLab