| Title: | Visualizes a Matrix as Heatmap |
|---|---|
| Description: | Visualizes a matrix object plainly as heatmap. It provides S3 functions to plot simple matrices and loading matrices. |
| Authors: | Sigbert Klinke [aut, cre], Frédéric Chevalier [ctb] |
| Maintainer: | Sigbert Klinke <[email protected]> |
| License: | GPL-3 |
| Version: | 1.6.2 |
| Built: | 2026-06-08 08:16:31 UTC |
| Source: | https://github.com/sigbertklinke/plot.matrix |
p-values of pairwise correlation test of the complete-cases of daily air quality measurements in New York, May to September 1973.
data(air.pvalue)data(air.pvalue)
A 4x4 matrix with p values of pairwise correlation tests (cor.test).
OzoneOzone (ppb)
Solar.RSolar R (lang)
WindWind (mph)
TempTemperature (degrees F)
The data are derived from the New York Air Quality Measurements data set.
Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983) Graphical Methods for Data Analysis. Belmont, CA: Wadsworth.
data(air.pvalue) plot(as.pvalue(air.pvalue))data(air.pvalue) plot(as.pvalue(air.pvalue))
as.XXX conversion functions
as.cor(x) as.assoc(x) as.pvalue(x)as.cor(x) as.assoc(x) as.pvalue(x)
x |
numeric matrix: matrix to convert |
a matrix with an appropriate class
# as.cor c <- cor(airquality, use="complete.obs") # as.assoc # as.pvalue data(air.pvalue) plot(as.pvalue(air.pvalue))# as.cor c <- cor(airquality, use="complete.obs") # as.assoc # as.pvalue data(air.pvalue) plot(as.pvalue(air.pvalue))
Assign to each value in x a color according to the choices of breaks and col.
assignColors(x, breaks = NULL, col = heat.colors, na.col = "white")assignColors(x, breaks = NULL, col = heat.colors, na.col = "white")
x |
numeric or non-numeric vector |
breaks |
vector with breaks |
col |
vector with colors or color function |
na.col |
color for NA or out-of-range values |
Depending if x is a numeric or non-numeric vector colors
are assigned to each value.
In case of a numeric vector breaks can be
a number, giving the number of intervals covering the range of x,
a vector of two numbers, given the range to cover with 10 intervals, or
a vector with more than two numbers, specify the interval borders
In case of a non-numeric vector breaks must contain all values which are
will get a color.
If breaks is not given then a sensible default is choosen:
in case of a numeric vector derived from pretty and
otherwise all unique values/levels are used.
col can be either be a vector of colors or a function which generates
via col(n) a set of n colors. The default is to use
heat.colors.
Possible color functions in R packages can be found by vignette('plot.matrix').
vector of color with the same length as x with the attributes
breaks the breaks used, col the color coding and na.col
the color for NA and out-of-range entries
## numeric vector x <- runif(10) assignColors(x) # set breaks assignColors(x, breaks=15) assignColors(x, breaks=c(0,1)) # set colors assignColors(x, col=c("red", "green", "blue")) assignColors(x, col=topo.colors) # NA and out-of-range x[5] <- NA assignColors(x, breaks=seq(0.5, 1, by=0.1), na.col="red") ## logical vector l <- sample(c(NA, TRUE, FALSE), size=10, replace=TRUE) assignColors(l) assignColors(l, breaks=c("FALSE", "TRUE"), col=c("red", "blue")) ## character vector t <- sample(letters, size=10, replace=TRUE) assignColors(t) assignColors(t, col=rainbow(5))## numeric vector x <- runif(10) assignColors(x) # set breaks assignColors(x, breaks=15) assignColors(x, breaks=c(0,1)) # set colors assignColors(x, col=c("red", "green", "blue")) assignColors(x, col=topo.colors) # NA and out-of-range x[5] <- NA assignColors(x, breaks=seq(0.5, 1, by=0.1), na.col="red") ## logical vector l <- sample(c(NA, TRUE, FALSE), size=10, replace=TRUE) assignColors(l) assignColors(l, breaks=c("FALSE", "TRUE"), col=c("red", "blue")) ## character vector t <- sample(letters, size=10, replace=TRUE) assignColors(t) assignColors(t, col=rainbow(5))
25 personality self report items taken from the International Personality Item Pool (ipip.ori.org) were included as
part of the Synthetic Aperture Personality Assessment (SAPA) web based personality assessment project.
In contrast to the original data bfi from the library psych (version 1.8.12)
it contains only the 25 personality self report items and the 2436 complete observations.
data(bfi.2)data(bfi.2)
A data frame with 2436 observations on the following 25 variables (the q numbers are the SAPA item numbers).
A1Am indifferent to the feelings of others. (q_146)
A2Inquire about others' well-being. (q_1162)
A3Know how to comfort others. (q_1206)
A4Love children. (q_1364)
A5Make people feel at ease. (q_1419)
C1Am exacting in my work. (q_124)
C2Continue until everything is perfect. (q_530)
C3Do things according to a plan. (q_619)
C4Do things in a half-way manner. (q_626)
C5Waste my time. (q_1949)
E1Don't talk a lot. (q_712)
E2Find it difficult to approach others. (q_901)
E3Know how to captivate people. (q_1205)
E4Make friends easily. (q_1410)
E5Take charge. (q_1768)
N1Get angry easily. (q_952)
N2Get irritated easily. (q_974)
N3Have frequent mood swings. (q_1099
N4Often feel blue. (q_1479)
N5Panic easily. (q_1505)
O1Am full of ideas. (q_128)
O2Avoid difficult reading material.(q_316)
O3Carry the conversation to a higher level. (q_492)
O4Spend time reflecting on things. (q_1738)
O5Will not probe deeply into a subject. (q_1964)
The 25 items are organized by five putative factors: Agreeableness, Conscientiousness, Extraversion, Neuroticism, and Opennness.
The item data were collected using a 6 point response scale:
Very Inaccurate
Moderately Inaccurate
Slightly Inaccurate
Slightly Accurate
Moderately Accurate
Very Accurate
as part of the Synthetic Apeture Personality Assessment (SAPA https://www.sapa-project.org/) project.
To see an example of the data collection technique, visit https://www.sapa-project.org/ or
the International Cognitive Ability Resource at https://icar-project.com/. The items given were sampled
from the International Personality Item Pool of Lewis Goldberg using the sampling technique of SAPA.
This is a sample data set taken from the much larger SAPA data bank.
The bfi.2 data set and items should not be confused with the BFI (Big Five Inventory) of Oliver John and colleagues (John, O. P., Donahue, E. M., & Kentle, R. L. (1991). The Big Five Inventory–Versions 4a and 54. Berkeley, CA: University of California,Berkeley, Institute of Personality and Social Research.)
The items are from the ipip (Goldberg, 1999). The data are from the SAPA project (Revelle, Wilt and Rosenthal, 2010), collected Spring, 2010 ( https://www.sapa-project.org/).
Goldberg, L.R. (1999) A broad-bandwidth, public domain, personality inventory measuring the lower-level facets of several five-factor models. In Mervielde, I. and Deary, I. and De Fruyt, F. and Ostendorf, F. (eds) Personality psychology in Europe. 7. Tilburg University Press. Tilburg, The Netherlands.
Revelle, W., Wilt, J., and Rosenthal, A. (2010) Individual Differences in Cognition: New Methods for examining the Personality-Cognition Link In Gruszka, A. and Matthews, G. and Szymura, B. (Eds.) Handbook of Individual Differences in Cognition: Attention, Memory and Executive Control, Springer.
Revelle, W, Condon, D.M., Wilt, J., French, J.A., Brown, A., and Elleman, L.G. (2016) Web and phone based data collection using planned missing designs. In Fielding, N.G., Lee, R.M. and Blank, G. (Eds). SAGE Handbook of Online Research Methods (2nd Ed), Sage Publcations.
data(bfi.2) library("psych") fa <- fa(bfi.2, 5, rotate="varimax") par(mar=c(5.1, 4.1, 4.1, 4.1)) # adapt margins plot(loadings(fa), cex=0.5)data(bfi.2) library("psych") fa <- fa(bfi.2, 5, rotate="varimax") par(mar=c(5.1, 4.1, 4.1, 4.1)) # adapt margins plot(loadings(fa), cex=0.5)
Rounds and adds trailing zeros (by default if digits is lower than 4).
fmt(x, digits = 2L, zeros = digits < 4L, ...)fmt(x, digits = 2L, zeros = digits < 4L, ...)
x |
numeric: vector. |
digits |
integer: Digits that should be used for rounding. |
zeros |
logical: Should trailing zeros be added? |
... |
passed to format for |
formatted x as text.
Similar to function fmt from the package exams.
In the function round2 has been replaced by round.
## this is also employed internally in the fmt() formatting function fmt(c(0.005, 0.015)) ## the main purpose of fmt() is that some numeric result can be displayed ## both at high accuracy and then at the rounding that students should do ## (e.g., with 2 or 3 digits) sol <- runif(1) fmt(sol, 6) fmt(sol, 2) ## but fmt() also assures showing a very high number of significant digits ## (up to 12) sol <- 123456 + sol sol fmt(sol, 6) fmt(sol, 2) ## and fmt() also takes care of adding trailing zeros (if digits < 4) fmt(1) fmt(1, digits = 3) fmt(1, digits = 6)## this is also employed internally in the fmt() formatting function fmt(c(0.005, 0.015)) ## the main purpose of fmt() is that some numeric result can be displayed ## both at high accuracy and then at the rounding that students should do ## (e.g., with 2 or 3 digits) sol <- runif(1) fmt(sol, 6) fmt(sol, 2) ## but fmt() also assures showing a very high number of significant digits ## (up to 12) sol <- 123456 + sol sol fmt(sol, 6) fmt(sol, 2) ## and fmt() also takes care of adding trailing zeros (if digits < 4) fmt(1) fmt(1, digits = 3) fmt(1, digits = 6)
Visualizes a association matrix with a colored or gray heatmap. As a rule of thumb the breaks are determined
by the effect sizes given by
Cohen (c(-1, -0.4, -0.2, -0.05, 0, +0.05, +0.2, +0.4, +1).
You may need to modify mar with the par command from its default
c(5.1,4.1,4.1,2.1).
See
vignette('plot.matrix') for detailed examples, and
plot.matrix for further parameters.
## S3 method for class 'assoc' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)## S3 method for class 'assoc' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)
x |
matrix: association within [0,+1] |
reorder |
logical: if the rows (variables) of the loading matrix should be reordered (default: |
gray |
logical: should be a gray scale color palette used or not (default: |
grey |
logical: should be a gray scale color palette used or not (default: |
... |
further parameter given to the |
If either the parameter grey or gray is TRUE then a gray color palette is used.
a plot
par(mar=c(5.1, 4.1, 4.1, 4.1)) # association matrix data(Titanic.cramer) plot(as.assoc(Titanic.cramer)) plot(as.assoc(Titanic.cramer), gray=TRUE) plot(as.assoc(Titanic.cramer[,1:3]), reorder=FALSE)par(mar=c(5.1, 4.1, 4.1, 4.1)) # association matrix data(Titanic.cramer) plot(as.assoc(Titanic.cramer)) plot(as.assoc(Titanic.cramer), gray=TRUE) plot(as.assoc(Titanic.cramer[,1:3]), reorder=FALSE)
Visualizes a correlation matrix with a colored or gray heatmap. As a rule of thumb the breaks are determined
by the effect sizes given by
Cohen (c(-1, -0.4, -0.2, -0.05, 0, +0.05, +0.2, +0.4, +1).
You may need to modify mar with the par command from its default
c(5.1,4.1,4.1,2.1).
See
vignette('plot.matrix') for detailed examples, and
plot.matrix for further parameters.
## S3 method for class 'cor' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)## S3 method for class 'cor' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)
x |
matrix: correlation within [-1,+1] |
reorder |
logical: if the rows (variables) of the loading matrix should be reordered (default: |
gray |
logical: should be a gray scale color palette used or not (default: |
grey |
logical: should be a gray scale color palette used or not (default: |
... |
further parameter given to the |
If either the parameter grey or gray is TRUE then a gray color palette is used.
a plot
par(mar=c(5.1, 4.1, 4.1, 4.1)) # correlation matrix c <- cor(airquality[,1:4], use="pairwise") plot(as.cor(c)) plot(as.cor(c), gray=TRUE) plot(as.cor(c[,1:3]), reorder=FALSE)par(mar=c(5.1, 4.1, 4.1, 4.1)) # correlation matrix c <- cor(airquality[,1:4], use="pairwise") plot(as.cor(c)) plot(as.cor(c), gray=TRUE) plot(as.cor(c[,1:3]), reorder=FALSE)
Visualizes the loadings matrix from a Factor Analysis or a Principal Component Analysis matrix
with a gray or colored heatmap. As a rule of thumb the breaks are determined by
c(-1, -0.866, -0.707, -0.5, -0.4, 0, +0.4, +0.5, +0.707, +0.866, +1) is used.
You may need to modify mar with the par command from its default
c(5.1,4.1,4.1,2.1).
See
vignette('plot.matrix') for detailed examples, and
plot.matrix for further parameters.
## S3 method for class 'loadings' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)## S3 method for class 'loadings' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)
x |
matrix: loadings |
reorder |
logical: if the rows (variables) of the loading matrix should be reordered (default: |
gray |
logical: should be a gray scale color palette used or not (default: |
grey |
logical: should be a gray scale color palette used or not (default: |
... |
further parameter given to the |
If either the parameter grey or gray is TRUE then a gray color palette is used.
a plot
data(bfi.2) library("psych") par(mar=c(5.1, 4.1, 4.1, 4.1)) # Factor analysis fa <- factanal(bfi.2, 5) plot(loadings(fa)) plot(loadings(fa), grey=TRUE) # Principal Component Analysis I pa <- princomp(bfi.2) plot(loadings(pa), digits=NA) # Principal Component Analysis II pa <- prcomp(bfi.2) ld <- structure(pa$rotation, class="loadings") plot(ld, digits=NA)data(bfi.2) library("psych") par(mar=c(5.1, 4.1, 4.1, 4.1)) # Factor analysis fa <- factanal(bfi.2, 5) plot(loadings(fa)) plot(loadings(fa), grey=TRUE) # Principal Component Analysis I pa <- princomp(bfi.2) plot(loadings(pa), digits=NA) # Principal Component Analysis II pa <- prcomp(bfi.2) ld <- structure(pa$rotation, class="loadings") plot(ld, digits=NA)
Visualizes a matrix with a colored heatmap and optionally a color key. It distinguishes between numeric and non-numeric matrices.
You may need to modify mar with the graphics::par() command from its default c(5.1,4.1,4.1,2.1).
For further see the vignette vignette('plot.matrix')
## S3 method for class 'matrix' plot( x, y = NULL, breaks = NULL, col = heat.colors, na.col = "white", na.cell = TRUE, na.print = TRUE, digits = NA, fmt.cell = NULL, fmt.key = NULL, spacing.key = c(1, 0.5, 0), polygon.cell = NULL, polygon.key = NULL, text.cell = NULL, key = list(side = 4, las = 1), axis.col = list(side = 1), axis.row = list(side = 2), axis.key = NULL, max.col = 70, ... )## S3 method for class 'matrix' plot( x, y = NULL, breaks = NULL, col = heat.colors, na.col = "white", na.cell = TRUE, na.print = TRUE, digits = NA, fmt.cell = NULL, fmt.key = NULL, spacing.key = c(1, 0.5, 0), polygon.cell = NULL, polygon.key = NULL, text.cell = NULL, key = list(side = 4, las = 1), axis.col = list(side = 1), axis.row = list(side = 2), axis.key = NULL, max.col = 70, ... )
x |
matrix |
y |
unused |
breaks |
breaks for numeric values or values for |
col |
a vector of colors or a function, e.g. grDevices::heat.colors()] with one parameter |
na.col |
color for missing value (default: white) |
na.cell |
to draw cells with missing values (default: |
na.print |
print NA (or any given characters) when values are missing. If |
digits |
number of digits for numeric data or length of string for non-numeric data |
fmt.cell |
format string for writing matrix entries, overwrites |
fmt.key |
format string for writing key entries, overwrites |
spacing.key |
spacing between plot and legend, key width, spacing between key and axis (default: |
polygon.cell |
list of parameters used for |
polygon.key |
list of parameters used for |
text.cell |
list of parameters used for |
key |
list of parameters used for [graphics::axis(). If set to |
axis.col |
list of parameters used for |
axis.row |
list of parameters used for |
axis.key |
as |
max.col |
numeric: if the distance between the text color and the cell color is smaller then |
... |
further parameter given to the |
A color key is drawn if either key (defaults to list(cex=1)) or fmt.key
(defaults to NULL) is not NULL.
If you want to plot the matrix entries you must set either digits or fmt.
For a non-numeric matrix digits gives the length of the string printed, a negative value
results in right-justified string. For a numeric matrix digits determines the number of
decimal places, a negative value uses a "exponential" decimal notation. You may set format
strings fmt and fmt.key directly. Settings digits leads to the following
format strings (n the absolute value of digits):
x numeric and digits>0: |
"%+.nf"
|
x numeric and digits<0: |
"%+.ne"
|
x non-numeric and digits>0: |
"%+ns"
|
x non-numeric and digits<0: |
"%-ns"
|
If no colors are given then the grDevices::heat.colors() will be used. Alternatively you may specify your own color function
that delivers a vector with n colors if called by col(n). The final colors and breaks used
depend if plot.matrix gets a numeric or non-numeric matrix.
Numeric matrix: In general it must hold length(col)+1==length(breaks).
breaks==NULL and col==NULL
The colors are taken from heat.colors(10) and the eleven breaks are calculated as an equidistant grid
between min(x) and max(x).
breaks==NULL and col is a color functionTen colors are taken from the color function and eleven breaks are calculated as an equidistant grid
between min(x) and max(x).
breaks==NULL and col is a vector of colorsThe length(col)+1 breaks are calculated as an equidistant grid
between min(x) and max(x).
breaks are given and col==NULL
The colors are taken from heat.colors(length(breaks)-1).
breaks are given and col is a color functionThe length(breaks)-1 colors are taken from the color function.
breaks are given and col is a vector of colorsIf not length(col)+1==length(breaks) holds then
the length(col)+1 breaks are calculated as an equidistant grid between min(breaks) and max(breaks).
Non-numeric matrix: In general it must hold length(col)==length(breaks). At first the number of unique elements in x is determined: nu.
breaks==NULL and col==NULL
The colors are taken from heat.colors(nu) and the breaks are set to the unique elements of x.
breaks==NULL and col is a color functionThe nu colors are taken from color function and the breaks are set to the unique elements of x.
breaks==NULL and col is a vector of colorsThe length(col) breaks are calculated as an equidistant grid
between min(x) and max(x).
breaks are given and color==NULL
The colors are taken from heat.colors(length(breaks)).
breaks are given and color is a color functionThe length(breaks) colors are taken from color function.
breaks are given and color is a vector of colorsIf not length(colors)==length(breaks) holds then
either breaks or color is shorten to the shorter of both.
If the difference between polygon color and the text color is smaller max.col then as text color is
either white or black (depending which one is further away from the polygon color).
The distance is computed as as in https://en.wikipedia.org/wiki/Color_difference#Euclidean given.
invisibly a list with elements
cell.polygon[[i,j]]the polygon parameters used to draw the elements of the matrix
cell.text[[i,j]]the text parameters used to draw the elements of the matrix
plotthe plot parameters used to draw the basic plot
axis.colthe axis parameters used to draw column axis
axis.rowthe axis parameters used to draw row axis
key.polygon[[i]]the polygon parameters used to draw the elements of the key
key.axisthe axis parameters used to draw key axis
A NULL means the elements has not been drawn.
The use of fmt or fmt.key have the same restrictions as the use of fmt in base::sprintf():
The format string is passed down the OS's sprintf function, and incorrect formats can cause the latter to crash the R process. R does perform sanity checks on the format, but not all possible user errors on all platforms have been tested, and some might be terminal.
par(mar=c(5.1, 4.1, 4.1, 4.1)) # numeric matrix x <- matrix(runif(50), nrow=10) plot(x) plot(x, key=NULL) plot(x, key=list(cex.axis=0.5, tick=FALSE)) plot(x, digits=3) plot(x, breaks=range(x), digits=3, cex=0.6) # logical matrix m <- matrix(runif(50)<0.5, nrow=10) plot(m) plot(m, col=c("red", "blue")) plot(m, key=NULL, digits=1) # character matrix s <- matrix(sample(letters[1:10], 50, replace=TRUE), nrow=10) plot(s) plot(s, col=topo.colors) plot(s, digits=10) plot(s, digits=1, col=heat.colors(5), breaks=letters[1:5]) plot(s, digits=1, col=heat.colors(5), breaks=c('a', 'c', 'e', 'g', 'i')) # contingency table tab <- table(round(rnorm(100)), round(rnorm(100))) plot(unclass(tab)) # chisquare test residuals cst <- chisq.test(apply(HairEyeColor, 1:2, sum)) col <- colorRampPalette(c("blue", "white", "red")) plot(cst$residuals, col=col, breaks=c(-7.5,7.5)) # triangular matrix x[upper.tri(x)] <- NA plot(x, digit=2) plot(x, na.print=FALSE) plot(x, na.cell=FALSE) # use the standard plot instead of plot.matrix x <- matrix(runif(50), nrow=2) plot(as.data.frame(x)) plot.default(x) ## Not run: # unload the package permanently with devtools library("devtools") unload('plot.matrix') ## End(Not run)par(mar=c(5.1, 4.1, 4.1, 4.1)) # numeric matrix x <- matrix(runif(50), nrow=10) plot(x) plot(x, key=NULL) plot(x, key=list(cex.axis=0.5, tick=FALSE)) plot(x, digits=3) plot(x, breaks=range(x), digits=3, cex=0.6) # logical matrix m <- matrix(runif(50)<0.5, nrow=10) plot(m) plot(m, col=c("red", "blue")) plot(m, key=NULL, digits=1) # character matrix s <- matrix(sample(letters[1:10], 50, replace=TRUE), nrow=10) plot(s) plot(s, col=topo.colors) plot(s, digits=10) plot(s, digits=1, col=heat.colors(5), breaks=letters[1:5]) plot(s, digits=1, col=heat.colors(5), breaks=c('a', 'c', 'e', 'g', 'i')) # contingency table tab <- table(round(rnorm(100)), round(rnorm(100))) plot(unclass(tab)) # chisquare test residuals cst <- chisq.test(apply(HairEyeColor, 1:2, sum)) col <- colorRampPalette(c("blue", "white", "red")) plot(cst$residuals, col=col, breaks=c(-7.5,7.5)) # triangular matrix x[upper.tri(x)] <- NA plot(x, digit=2) plot(x, na.print=FALSE) plot(x, na.cell=FALSE) # use the standard plot instead of plot.matrix x <- matrix(runif(50), nrow=2) plot(as.data.frame(x)) plot.default(x) ## Not run: # unload the package permanently with devtools library("devtools") unload('plot.matrix') ## End(Not run)
Visualizes a matrix of p-values with a colored or gray heatmap. As a rule of thumb the breaks are determined
by c(0, 0.001, 0.01, 0.05, 0.1, 1)
You may need to modify mar with the par command from its default
c(5.1,4.1,4.1,2.1).
See
vignette('plot.matrix') for detailed examples, and
plot.matrix for further parameters.
## S3 method for class 'pvalue' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)## S3 method for class 'pvalue' plot(x, reorder = TRUE, gray = FALSE, grey = FALSE, ...)
x |
matrix: p-values within [0,1] |
reorder |
logical: if the rows (variables) of the loading matrix should be reordered (default: |
gray |
logical: should be a gray scale color palette used or not (default: |
grey |
logical: should be a gray scale color palette used or not (default: |
... |
further parameter given to the |
If either the parameter grey or gray is TRUE then a gray color palette is used.
a plot
par(mar=c(5.1, 4.1, 4.1, 4.1)) # correlation matrix data(air.pvalue) plot(as.pvalue(air.pvalue)) plot(as.pvalue(air.pvalue), gray=TRUE) plot(as.pvalue(air.pvalue[,1:3]), reorder=FALSE)par(mar=c(5.1, 4.1, 4.1, 4.1)) # correlation matrix data(air.pvalue) plot(as.pvalue(air.pvalue)) plot(as.pvalue(air.pvalue), gray=TRUE) plot(as.pvalue(air.pvalue[,1:3]), reorder=FALSE)
Matrix of Cramer's V computed on the variables economic status (class), sex, age and survival of the fate of passengers on the fatal maiden voyage of the ocean liner 'Titanic'.
data(Titanic.cramer)data(Titanic.cramer)
A 4x4 matrix with Cramer's V computed on
Class1st, 2nd, 3rd, Crew
SexMale, Female
AgeChild, Adult
SurvivedNo, Yes
The data are derived from the Survival of passengers on the Titanic data set.
data(Titanic.cramer) plot(as.assoc(Titanic.cramer))data(Titanic.cramer) plot(as.assoc(Titanic.cramer))