I need to split the elements of an array by its column mean, how can I do this, is there any function to perform this simple operation?
Considering the array:
> A <- matrix(1:16, ncol = 4)
> A
[,1] [,2] [,3] [,4]
[1,] 1 5 9 13
[2,] 2 6 10 14
[3,] 3 7 11 15
[4,] 4 8 12 16
And the average of each column in the vector:
> MediacolA <- colMeans(A)
> MediacolA
[1] 2.5 6.5 10.5 14.5