as.likert: Support functions for diverging stacked barcharts for Likert,...

View source: R/as.likert.R

as.likertR Documentation

Support functions for diverging stacked barcharts for Likert, semantic differential, and rating scale data.

Description

Constructs class="likert" objects to be used by the plot.likert methods.

Usage


is.likert(x)

as.likert(x, ...)
## Default S3 method:
as.likert(x, ...)
## S3 method for class 'data.frame'
as.likert(x, ...)
## S3 method for class 'formula'
as.likert(x, ...)  ## doesn't work yet
## S3 method for class 'ftable'
as.likert(x, ...)
## S3 method for class 'table'
as.likert(x, ...)
## S3 method for class 'matrix'
as.likert(x,
          ReferenceZero=NULL,
          ...,
          rowlabel=NULL, collabel=NULL,
          xlimEqualLeftRight=FALSE,
          xTickLabelsPositive=TRUE,
          padding=FALSE,
          reverse.left=TRUE)
## S3 method for class 'listOfNamedMatrices'
as.likert(x, ...)
## S3 method for class 'array'
as.likert(x, ...)


## S3 method for class 'likert'
rev(x)

is.likertCapable(x, ...)

Arguments

x

For the as.likert methods, a numeric object stored as a vector, matrix, two-dimensional table, two-dimensional ftable, two-dimensional structable (as defined in the vcd package), or list of named matrices. For functions is.likert and is.likertCapable, any object. This is the only required argument.

rowlabel, collabel

names(dimnames(x)), where x is the argument to the as.likert functions. These will become the xlab and ylab of the likert plot.

...

other arguments. They will be ignored by the as.likert method.

ReferenceZero

Please see discussion of this argument in likert.

xlimEqualLeftRight

Logical. The default is FALSE. If TRUE, then the left and right x limits are set to negative and positive of the larger of the absolute value of the original x limits.

xTickLabelsPositive

Logical. The default is TRUE. If TRUE, then the tick labels on the negative side are displayed as positive values.

padding, reverse.left

padding is FALSE for likert and TRUE for likertMosaic. reverse.left is TRUE for likert and FALSE for likertMosaic. likert is based on barchart and requires that the sequencing of negative values be reversed. likertMosiac is based on mosaic and needs padding on left and right to fill the rectangle implied by the convex hull of the plot.

Details

Please see likert for information on the plot for which as.likert prepares the data.

Value

For the as.likert methods, a likert object, which is a matrix with additional attributes that are needed to make the barchart method used by the plot.likert methods work with the data. Columns for respondents who disagree have negated values. Any NA values in the argument x are changed to 0. The column of the original data for respondents who neither agree nor disagree is split into two columns, each containing halved values—one positive and one negative. Negative columns come first in the sequence of "No Opinion"(negative)–"Strongly Disagree", followed by "No Opinion"(positive)–"Strongly Agree". There are four attributes: "even.col" indicating whether there were originally an even number of columns, "n.levels" the original number of levels, "levels" the original levels in the original order, "positive.order" The sequence in which to display the rows in order to make the right hand sides progress with high values on top.

is.likert returns a TRUE or FALSE value.

is.likertCapable returns a TRUE or FALSE value if the argument can used as an argument to one of the plot.likert methods.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

References

Richard M. Heiberger, Naomi B. Robbins (2014)., "Design of Diverging Stacked Bar Charts for Likert Scales and Other Applications", Journal of Statistical Software, 57(5), 1–32, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v057.i05")}.

Naomi Robbins <naomi@nbr-graphs.com>, "Visualizing Data: Challenges to Presentation of Quality Graphics—and Solutions", Amstat News, September 2011, 28–30.

Naomi B. Robbins and Richard M. Heiberger (2011). Plotting Likert and Other Rating Scales. In JSM Proceedings, Section on Survey Research Methods. Alexandria, VA: American Statistical Association.

Luo, Amy and Tim Keyes (2005). "Second Set of Results in from the Career Track Member Survey," Amstat News. Arlington, VA: American Statistical Association.

See Also

likert

Examples

## Please see ?likert to see these functions used in context.

tmp2 <- array(1:12, dim=c(3,4), dimnames=list(B=LETTERS[3:5], C=letters[6:9]))
as.likert(tmp2)  ## even number of levels.

is.likert(tmp2)
is.likert(as.likert(tmp2))

HH documentation built on May 29, 2024, 6:24 a.m.

Related to as.likert in HH...