Title: | Automatic Correlation and Regression Test in a 'data.frame' |
---|---|
Description: | Perform correlation and linear regression test among the numeric fields in a data.frame automatically and make plots using pairs or lattice::parallelplot. |
Authors: | Keon-Woong Moon [aut, cre] |
Maintainer: | Keon-Woong Moon <[email protected]> |
License: | CC0 |
Version: | 0.1.1 |
Built: | 2025-03-13 02:44:48 UTC |
Source: | https://github.com/cardiomoon/mycor |
Perform correlation and linear regression for a data.frame automatically
mycor(x, ..., digits) ## Default S3 method: mycor(x, ..., digits = 3) ## S3 method for class 'formula' mycor(formula, data, ..., digits = 3)
mycor(x, ..., digits) ## Default S3 method: mycor(x, ..., digits = 3) ## S3 method for class 'formula' mycor(formula, data, ..., digits = 3)
x |
A data.frame. |
... |
further arguments to be passed to |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used. |
formula |
a formula of the form ~ u + v, where each of u and v are numeric variables giving the data values for one sample. The samples must be of the same length. |
data |
A data.frame |
mycor |
Object to mycor |
mycor returns as object of class "mycor"
The function summary is used to print a summary of the result. The function
plot is used to plot the results using pairs
and parallelplot
.
An object of class "mycor:" is a list containing at least following components:
a data.frame
logical vectors returns if columns of df is.numeric
a list of class "htest" from cor.test
between the last paired samples in a data.frame.
a matrix consist of r values from cor.test
between all pairs of numeric data from a data.frame
a matrix consist of p values from cor.test
between all pairs of numeric data from a data.frame
a matrix consist of slope values from lm
between all pairs of numeric data from a data.frame
a matrix consist of intercept values from lm
between all pairs of numeric data from a data.frame
default
: for class data.frame
formula
: for class "formula"
out=mycor(iris) plot(out) plot(out, groups=Species) plot(out,type=2,groups=species) plot(out,type=4,groups=species) out1=mycor(~mpg+disp+wt+hp,data=mtcars,alternative="greater",methods="kendall", conf.level=0.95) plot(out1,type=3) plot(out1,type=4,groups=cyl)
out=mycor(iris) plot(out) plot(out, groups=Species) plot(out,type=2,groups=species) plot(out,type=4,groups=species) out1=mycor(~mpg+disp+wt+hp,data=mtcars,alternative="greater",methods="kendall", conf.level=0.95) plot(out1,type=3) plot(out1,type=4,groups=cyl)
Correlation and Fitting linear model function for function "mycor"
mylm(y, x, ..., digits = 3)
mylm(y, x, ..., digits = 3)
y |
numeric vectors of data values |
x |
numeric vectors of data values |
... |
further arguments to be passed to or from methods. |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used. |
mylm returns a list of following components
a list of class "htest" from cor.test
between the last paired samples in a data.frame.
a numeric vector of length 4, consist of r and p values
from cor.test
,slope and intercept values from
lm
between numeric vector y and x
Make correlation plot for plot of class "mycor"
panel.cor(x, y, digits = 2, prefix = "", cex.cor)
panel.cor(x, y, digits = 2, prefix = "", cex.cor)
x |
a numeric vector |
y |
a numeric vector |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used. |
prefix |
a character vector |
cex.cor |
a numeric variable |
Make plot with histogram for plot of class "mycor"
panel.hist(x, ...)
panel.hist(x, ...)
x |
a numeric vector |
... |
further arguments to be passed to or from methods. |
Plot for an object of class "mycor"
## S3 method for class 'mycor' plot(x, ..., groups = -1, type = 1)
## S3 method for class 'mycor' plot(x, ..., groups = -1, type = 1)
x |
an object of class "mycor" |
... |
further arguments to be passed to |
groups |
a variable to be evaluated in a data.frame x$df, expected to act as a grouping variable within each panel, typically used to distinguish different groups by varying graphical parameters like color and line type. |
type |
specify the type of plot |
out=mycor(iris) plot(out) plot(out, groups=Species) plot(out,type=2,groups=species) out1=mycor(mtcars[1:5],alternative="greater",methods="kendall", conf.level=0.95) plot(out1,type=3) plot(out1,type=4,groups=cyl)
out=mycor(iris) plot(out) plot(out, groups=Species) plot(out,type=2,groups=species) out1=mycor(mtcars[1:5],alternative="greater",methods="kendall", conf.level=0.95) plot(out1,type=3) plot(out1,type=4,groups=cyl)
Print function for class "mycor"
## S3 method for class 'mycor' print(x, ...)
## S3 method for class 'mycor' print(x, ...)
x |
an object of class "mycor", a result of a call to |
... |
further arguments to be passed to or from methods. |
out=mycor(iris) print(out)
out=mycor(iris) print(out)
Summarizing function for class "mycor"
## S3 method for class 'mycor' summary(object, ...)
## S3 method for class 'mycor' summary(object, ...)
object |
an object of class "mycor", a result of a call to |
... |
further arguments to be passed to or from methods. |
out=mycor(iris) summary(out)
out=mycor(iris) summary(out)