Learn R Programming

Deducer (version 0.9-1)

cor.matrix: cor.matrix

Description

Creates a correlation matrix

Usage

cor.matrix(variables,with.variables,data=NULL,test=cor.test,...)

Value

A multi.test object, representing a table of the results of func

applied to each of the variables.

Arguments

variables

variables

with.variables

An optional set of variables to correlate with variables. If nothing is specified, all variables in variables are correlated with themselves.

data

A data.frame from which the variables and factor will be selected.

test

A function whose first two arguments are the variables upon which the correlation will be calculated, and whose result is an object of class htest.

...

further arguments for test.

See Also

cor.test as.matrix.cor.matrix

Examples

Run this code
dat<-data.frame(aa=rnorm(100),bb=rnorm(100),cc=rnorm(100),dd=rnorm(100))
dat$aa<-dat$aa+dat$dd
dat$cc<-dat$cc+dat$aa
cor.matrix(dat,test=cor.test)
cor.matrix(d(aa,cc),data=dat,test=cor.test,method="kendall")
cor.matrix(d(aa,cc),d(dd,bb),data=dat,test=cor.test,method="spearman")

Run the code above in your browser using DataLab