Last data update: 2014.03.03

R: Correlation matrix
ggcorplotR Documentation

Correlation matrix

Description

Plots a correlation matrix

Usage

ggcorplot(cor.mat,data=NULL,lines=TRUE,line.method=c("lm","loess"),type="points",
		alpha=.25,main="auto",var_text_size=5,
		cor_text_limits=c(5,25),level=.05)

Arguments

cor.mat

a cor.matrix object to plot

data

the data.frame used to compute the correlation matrix

lines

Logical. Should regression lines be drawn.

type

type of plot. "points" or "bins"

line.method

Character. Type of regression line.

alpha

numeric. level of alpha transparency for the points.

main

Title of the plot. defaults to the method of cor.mat.

var_text_size

size of the diagonal variable names.

cor_text_limits

lower and upper bounds for the size of the correlation text.

level

the size of the test differentiated by text color.

Author(s)

Mike Lawrence and Ian Fellows

See Also

cor.matrix qscatter_array

Examples

data(mtcars)
corr.mat1<-cor.matrix(variables=d(mpg,carb,carb+rnorm(length(carb))),,
	 data=mtcars,
	 test=cor.test,
	 method='spearman',
	alternative="two.sided",exact=FALSE)
	
p<-ggcorplot(corr.mat1,data = mtcars)
print(p)
## Not run: 

has.hex<-require("hexbin")
if(has.hex){
	data(diamonds)
	corr.mat<-cor.matrix(variables=d(price,carat,color),,
		 data=diamonds,
		 test=cor.test,
		 method='spearman',
		alternative="two.sided")

	p1 <- ggcorplot(cor.mat=corr.mat,data=diamonds,type="bins",
		cor_text_limits=c(5,15),
		lines=FALSE)
	print(p1)
	rm('corr.mat')

}

## End(Not run)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Deducer)
Loading required package: ggplot2
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots

Please type JGR() to launch console. Platform specific launchers (.exe and .app) can also be obtained at http://www.rforge.net/JGR/files/.


Loading required package: car
Loading required package: MASS


Note Non-JGR console detected:
	Deducer is best used from within JGR (http://jgr.markushelbig.org/).
	To Bring up GUI dialogs, type deducer().

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Deducer/ggcorplot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ggcorplot
> ### Title: Correlation matrix
> ### Aliases: ggcorplot
> 
> ### ** Examples
> 
> data(mtcars)
> corr.mat1<-cor.matrix(variables=d(mpg,carb,carb+rnorm(length(carb))),,
+ 	 data=mtcars,
+ 	 test=cor.test,
+ 	 method='spearman',
+ 	alternative="two.sided",exact=FALSE)
> 	
> p<-ggcorplot(corr.mat1,data = mtcars)
> print(p)
> ## Not run: 
> ##D 
> ##D has.hex<-require("hexbin")
> ##D if(has.hex){
> ##D 	data(diamonds)
> ##D 	corr.mat<-cor.matrix(variables=d(price,carat,color),,
> ##D 		 data=diamonds,
> ##D 		 test=cor.test,
> ##D 		 method='spearman',
> ##D 		alternative="two.sided")
> ##D 
> ##D 	p1 <- ggcorplot(cor.mat=corr.mat,data=diamonds,type="bins",
> ##D 		cor_text_limits=c(5,15),
> ##D 		lines=FALSE)
> ##D 	print(p1)
> ##D 	rm('corr.mat')
> ##D 
> ##D }
> ## End(Not run)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>