Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

title author date output
package mycor
Keon-Woong Moon <cardiomoon@gmail.com>
2014-10-01
html_document

Package mycor

This package is for automatic correlation and linear regeression test of a data.frame like cor() in R. Function cor() get r values from a numeric vector, matrix or data.frame, but it does not work in a data.frame consist of numeric, factor or character variables.
If you wanted to get p values as well as r values, you should use cor.test instead of cor. But cor.test can deal with only one pair of numeric vectors of the same length, neither a matrix nor a data.frame. Furthermore, if you wanted to get the slope and intercept of simple linear regression line of xyplot, you had to perform lm test for every pairs of numeric variables of the data.frame.

The main function of this package is mycor(). It returns an object of S3 class "mycor" consist of r values and p values as well as slope and intercept from lm() test. Plot "mycor" object is very simple and convenient. Plot.mycor function has four types of plots.

require(mycor)
out=mycor(iris)
out

$ r value by Pearson's product-moment correlation 

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length        1.000      -0.118        0.872       0.818
Sepal.Width        -0.118       1.000       -0.428      -0.366
Petal.Length        0.872      -0.428        1.000       0.963
Petal.Width         0.818      -0.366        0.963       1.000

$ p value ( two.sided )

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length        0.000       0.152            0           0
Sepal.Width         0.152       0.000            0           0
Petal.Length        0.000       0.000            0           0
Petal.Width         0.000       0.000            0           0
out1=mycor(~mpg+wt+disp+hp,data=mtcars)
plot(out,groups=Species)

plot of chunk unnamed-chunk-1

plot(out,type=4,groups=Spec)

plot of chunk unnamed-chunk-1

plot(out1,type=2,groups=cyl)

plot of chunk unnamed-chunk-1

About

No description, website, or topics provided.

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.