CAdist {SPARTAAS}R Documentation

Distance matrix based on correspondence analysis results

Description

Perform a correspondence analysis on a contingency table and then return the distance matrix of the coordinates (you can choose the number of axes to use to build the distance matrix with the nCP parameter).

Usage

CAdist(df, nPC = NULL, graph = TRUE)

Arguments

df

Data.frame, matrix or table with the data for the correspondence analysis.

nPC

Number of principal components to be retained for the construction of the distance matrix. Must be between 1 and the minimum of ncol - 1 and nrow - 1. Could also be "max".

graph

Logical parameter for plotting the Correspondence Analysis (Axis1, Axis2).

Value

D

The distance matrix

Author(s)

A. COULON

L. BELLANGER

P. HUSI

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
library(SPARTAAS)
data(datangkor)

## contingency table
cont <- datangkor$contingency

distance <- CAdist(cont, nPC = "max")
distance

## run without printing the plot
distance <- CAdist(cont, nPC = "max", graph=FALSE)

[Package SPARTAAS version 1.2.1 Index]