Column one (x[, 1]
) has the original signal.
Column 2 (x[, 2]
) has the improved signal.
I want to have them now as a single column for the following line.
Code for single column reference in x[, 1]
# http://stackoverflow.com/a/40329062/54964
M <- cor(sapply(files, function(x) x[, 1]))
Pseudocode x[, 1:2]
for taking both columns in a long column - second column after the first one
M_both <- cor(sapply(files, function(x) x[, 1:2]))
I think this can be done by many measures, maybe concatenating also in R. I have about 100x2 cases so the matrix sizes are 100x100 x2.
c(x[,1],x[,2])
is not making a big column.
Structure of files
by str(files)
List of 2
$ :'data.frame': 541650 obs. of 2 variables:
..$ V1: num [1:541650] -0.13 -0.165 -0.17 -0.135 -0.12 -0.11 -0.12 -0.135 -0.155 -0.145 ...
..$ V2: num [1:541650] -0.535 -0.515 -0.505 -0.505 -0.505 -0.5 -0.495 -0.49 -0.48 -0.48 ...
$ :'data.frame': 541650 obs. of 2 variables:
..$ V1: num [1:541650] -0.2 -0.195 -0.185 -0.18 -0.17 -0.16 -0.16 -0.16 -0.155 -0.145 ...
..$ V2: num [1:541650] -0.43 -0.38 -0.375 -0.515 -0.605 -0.575 -0.525 -0.505 -0.495 -0.49 ...
Output of Luke1018's answer
I do
M_both <- cor(sapply(files, function(x) c(x[, 1],x[, 2]) ))
makeMatrixPlot(M_both, ids)
Fig. 1 Initial output on left with single columns, while output of two columns at the right-hand side
OS: Debian 8.5
R: 3.1.1