Hi Farhad, be sure if you can, to ask your programming question as a reproducible example.
The correlation between two vectors in R is the cor function. For example;
x = 1:3
y = 4:2
cor(x,y, method = "pearson")
#> [1] -1
Created on 2018-05-11 by the reprex package (v0.2.0).
It looks like you're dealing with a data frame. And it looks like you want to get all the combinations of columns?
df = matrix(c(2,4,3,1,5,7,1,2,3,5,8,2,4,5,1,1,3,6,1,3,4,5,6,1),nrow=6,ncol=4,byrow = TRUE)
df = as.data.frame(df)
df
#> V1 V2 V3 V4
#> 1 2 4 3 1
#> 2 5 7 1 2
#> 3 3 5 8 2
#> 4 4 5 1 1
#> 5 3 6 1 3
#> 6 4 5 6 1
cor(df, method = "pearson")
#> V1 V2 V3 V4
#> V1 1.0000000 0.7385489 -0.2533202 0.0000000
#> V2 0.7385489 1.0000000 -0.4287465 0.6324555
#> V3 -0.2533202 -0.4287465 1.0000000 -0.1898142
#> V4 0.0000000 0.6324555 -0.1898142 1.0000000
Created on 2018-05-11 by the reprex package (v0.2.0).
You'll want to extract all those combinations in the last table.
How comfortable with R are you at this point?