ds.correlation {DescriptiveStats.OBeu} | R Documentation |
Correlation Coefficient of a dataframe
Description
This functions calculates the correlation coefficient of the input vectors, matrix or data frame. By default, the correlation coefficient of pearson is computed.
Usage
ds.correlation(x, y = NULL, cor.method = "pearson", tojson = FALSE)
Arguments
x |
A numeric vector, matrix or data frame |
y |
A vector, matrix or data frame with same dimension as x. By default it is equal with NULL. |
cor.method |
The correlation coefficient method to compute: "pearson" (default), "kendall" or "spearman". |
tojson |
If TRUE the results are returned in json format, default returns a data frame |
Details
This function returns an upper triangle matrix with the correlation coefficients of the input data. The correlation coefficient of pearson is computed, by default. Other options are "kendall" or "spearman".
Author(s)
Aikaterini Chatzopoulou, Kleanthis Koupidis, Charalampos Bratsas
See Also
Examples
# iris data frame as an input and the default parameters
ds.correlation(iris, cor.method = "pearson", tojson = FALSE)
# with matrix as an input , different parameters and json output
Matrix <- cbind(Uni05 = (1:200)/21, Norm = rnorm(200),
`5T` = rt(200, df = 5), Gam2 = rgamma(200, shape = 2))
ds.correlation(Matrix, cor.method = "kendall", tojson = TRUE)
[Package DescriptiveStats.OBeu version 1.3.2 Index]