Description Usage Arguments Value Examples
Correlation
1 | correlation(x, y = NULL, method = "Pearson", file = "None")
|
x |
a numeric vector, matrix, or data.frame. |
y |
a numeric vector. y must be NULL if x is a matrix or a data.frame. |
method |
Pearson or Spearman method for calculate correlation. Default Pearson. |
file |
In case of x been a data.frame or matrix, represent the name of output file for saving mutual information plot. |
In case of x been a data.frame or matrix, correlation of all variables/columns in x. Otherwise, correlation of x and y.
1 2 3 4 5 6 7 8 9 10 | df <- data.frame("V1" = sample.int(3000,100,replace=FALSE), "V2" =sample.int(3000,100,replace=FALSE) , "V3" = sample.int(3000,100,replace=FALSE), "V4" = sample.int(3000,100,replace=FALSE), "V5" = sample.int(3000,100,replace=FALSE), "V6" = sample.int(3000,100,replace=FALSE), "V7" = sample.int(3000,100,replace=FALSE), "V8" = sample.int(3000,100,replace=FALSE))
x <- c(35,23,47, 17, 10, 43, 9, 6, 28)
y <- c(30, 33, 45, 23, 8, 49, 12, 4, 31)
correlation(x = x, y = y, method = "Pearson")
correlation(x = x, y = y, method = "Spearman")
correlation(x = df, method = "Pearson")
correlation(x = df, method = "Spearman")
correlation(x = df, method = "Pearson", file = "pearsonCor")
correlation(x = df, method = "Spearman", file = "spearmanCor")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.