Usage
likert(x, ...)
likertplot(x, ...)
## S3 method for class 'likert':
plot(x, ...)## S3 method for class 'formula':
plot.likert(x, data, ReferenceZero=NULL, value, levelsName="",
scales.in=NULL, ## use scales=
between=list(x=1 + (horizontal), y=.5 + 2*(!horizontal)),
auto.key.in=NULL, ## use auto.key=
panel.in=NULL, ## use panel=
horizontal=TRUE,
par.settings.in=NULL, ## use par.settings=
...,
as.percent = FALSE,
## titles
ylab= if (horizontal) {
if (length(x)==3)
deparse(x[[2]])
else
"Question"
}
else
if (as.percent != FALSE) "Percent" else "Count",
xlab= if (!horizontal) {
if (length(x)==3)
deparse(x[[2]])
else
"Question"
}
else
if (as.percent != FALSE) "Percent" else "Count",
main = x.sys.call,
## right axis
rightAxisLabels = rowSums(data.list$Nums),
rightAxis = !missing(rightAxisLabels),
ylab.right = if (rightAxis) "Row Count Totals" else NULL,
xlab.top = NULL,
## scales
xscale.components = xscale.components.top.HH,
yscale.components = yscale.components.right.HH,
xlimEqualLeftRight = FALSE,
xTickLabelsPositive = TRUE,
## row sequencing
as.table=TRUE,
positive.order=FALSE,
data.order=FALSE,
reverse=ifelse(horizontal, as.table, FALSE),
## resizePanels arguments
h.resizePanels=sapply(result$y.used.at, length),
w.resizePanels=sapply(result$x.used.at, length),
## color options
reference.line.col="gray65",
key.border.white=TRUE,
col=likertColor(Nums.attr$nlevels,
ReferenceZero=ReferenceZero,
colorFunction=colorFunction,
colorFunctionOption=colorFunctionOption),
colorFunction="diverge_hcl",
colorFunctionOption="lighter"
)
## S3 method for class 'default':
plot.likert(x,
positive.order=FALSE,
ylab=names(dimnames(x)[1]),
xlab=if (as.percent != FALSE) "Percent" else "Count",
main=xName,
reference.line.col="gray65",
col.strip.background="gray97",
col=likertColor(attr(x, "nlevels"),
ReferenceZero=ReferenceZero,
colorFunction=colorFunction,
colorFunctionOption=colorFunctionOption),
colorFunction="diverge_hcl",
colorFunctionOption="lighter",
as.percent=FALSE,
par.settings.in=NULL,
horizontal=TRUE,
ReferenceZero=NULL,
...,
key.border.white=TRUE,
xName=deparse(substitute(x)),
rightAxisLabels=rowSums(abs(x)),
rightAxis=!missing(rightAxisLabels),
ylab.right=if (rightAxis) "Row Count Totals" else NULL,
panel=panel.barchart,
xscale.components=xscale.components.top.HH,
yscale.components=yscale.components.right.HH,
xlimEqualLeftRight=FALSE,
xTickLabelsPositive=TRUE,
reverse=FALSE)
## S3 method for class 'array':
plot.likert(x,
condlevelsName=paste("names(dimnames(", xName, "))[-(1:2)]",
sep=""),
xName=deparse(substitute(x)),
main=paste("layers of", xName, "by", condlevelsName),
...)
## S3 method for class 'likert':
plot.likert(x, ...) ## See Details
## S3 method for class 'list':
plot.likert(x, ## named list of matrices, 2D tables,
## 2D ftables, or 2D structables,
## or all-numeric data.frames
condlevelsName="ListNames",
xName=deparse(substitute(x)),
main=paste("List items of", xName, "by", condlevelsName),
layout=if (length(dim.x) > 1) dim.x else {
if (horizontal) c(1, length(x)) else c(length(x), 1)},
positive.order=FALSE,
strip=!horizontal,
strip.left=horizontal,
strip.left.values=names(x),
strip.values=names(x),
strip.par=list(cex=1, lines=1),
strip.left.par=list(cex=1, lines=1),
horizontal=TRUE,
...,
rightAxisLabels=sapply(x, function(x) rowSums(abs(x)), simplify = FALSE),
rightAxis=!missing(rightAxisLabels),
resize.height.tuning=-.5,
resize.height=if (missing(layout) || length(dim.x) != 2) {
c("nrow","rowSums")
} else {
rep(1, layout[2])
},
resize.width=if (missing(layout)) {1 } else {
rep(1, layout[1])
},
box.ratio=if (
length(resize.height)==1 &&
resize.height == "rowSums") 1000 else 2,
xscale.components=xscale.components.top.HH,
yscale.components=yscale.components.right.HH)
## S3 method for class 'table':
plot.likert(x, ..., xName=deparse(substitute(x)))
## S3 method for class 'ftable':
plot.likert(x, ..., xName=deparse(substitute(x)))
## S3 method for class 'structable':
plot.likert(x, ..., xName=deparse(substitute(x)))## S3 method for class 'data.frame':
plot.likert(x, ..., xName=deparse(substitute(x)))
xscale.components.top.HH(...)
yscale.components.right.HH(...)
Arguments
x
For the formula method, a model formula. All terms in the
formula must be the names of columns in the data.frame argument
data
or the special abbreviation .
only on the right-hand-side. Functions of the
names wil
data
For the formula method, a data.frame
.
Do not use variable names ".value"
or ".variable"
.
ReferenceZero
Numeric scalar or NULL
. The position in
the range
seq(0, attr(x, "nlevels")+.5, .5)
where the
reference line at 0 will be placed. attr(x, "nlevels")
is the
number of columns of the original argument
value
Name of the numeric variable containing the data when the
formula method is used with the long data form. The predictor in the
formula will be a factor name. The name of the predictor will be
used as the title in the key.
levelsName
(optional) Name of the implied factor distinguishing the
columns of the response variables when the formula method is used
with the wide data form. This name will be used as the title in the key.
positive.order
If FALSE
, the default value, the original
order of the rows is retained. This is necessary for arrays,
because each panel has the same rownames. If TRUE
, rows are
ordered within each panel with the row whose bar
data.order
formula
method only. If
positive.order
is TRUE
, this data.order
variable is ignored.
If FALSE
, the default value, and the rows are specified by a
factor, then they are o
as.percent
When as.percent==TRUE
or
as.percent=="noRightAxis"
, then the values in each row are rescaled
to row percents.
When as.percent==TRUE
the original row totals are used as
rightAxisLabels
as.table
Standard lattice
argument. See barchart
. par.settings.in, scales.in, auto.key.in,
panel.in
These are placeholders
for lattice
arguments that lets the user
specify some lattice par.settings
and still retain the
ones that are prespecified in the
plot.likert.default
.
ylab, xlab, ylab.right, xlab.top, main
Standard lattice
graph
labels in barchart
. between
Standard lattice
argument.
col
Vector of color names for the levels of the agreement factor.
Although the colors can be specified as an arbitrary vector of color names, for example,
col=c('red','blue','#4AB3F2')}, usually specifying one of the diverging
palettes fr