xlim4ca: Retrieve Range of Coordinates to be used in Correspondence...

Description Usage Arguments Value Examples

Description

The function xlim4ca takes as its input an object of class "ca", and returns the range of principal coordinates to be used in the first dimension of the correspondence analysis plot. The function ylim4ca takes as its input an object of class "ca", and returns the range of principal coordinates to be used in the first dimension of the correspondence analysis plot.

Usage

1
2

Arguments

x

object of class "ca"

...

(not used for the moment)

Value

The function xlim4ca returns a numeric vector of length two containing the lower and upper boundary of the x-axis to be used in a biplot of the correspondence analysis solution in object.

The function ylim4ca returns a numeric vector of length two containing the lower and upper boundary of the y-axis to be used in a biplot of the correspondence analysis solution in x.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## traditional biplot, using the basic tools from the
## package ca
data("author") # available from package ca
author_ca <- ca(author)
plot(author_ca)

## alternative plot, using the coordinates retrieved with
## row_pcoord() and col_pcoord()
r_pc <- row_pcoord(author_ca)
c_pc <- col_pcoord(author_ca)
xlim <- xlim4ca(author_ca)     # range of dim 1
ylim <- ylim4ca(author_ca)     # range of dim 2
author_names <- as.factor(gsub("^.*?\\((.*?)\\)$", "\\1",
  rownames(author), perl = TRUE))
plot(r_pc[,1], r_pc[,2], pch = 18, 
     xlim = xlim, ylim = ylim, xlab = "", ylab = "",
     main = "authors and their alphabet",
     col = as.numeric(author_names))
abline(h = 0, col = "gray", lty = 3)
abline(v = 0, col = "gray", lty = 3)
text(c_pc[,1], c_pc[,2], colnames(author), col = "gray")
legend("topright", 
       legend = levels(author_names),  
       pch = rep(18, length(levels(author_names))),
       col = 1:length(levels(author_names)), 
       title = "authors")

wai-wong-reimagine/mclm documentation built on May 16, 2019, 9:12 p.m.