# Covariance.R

# Let x be a matrix
# cov(x) returns covariances column-wise. 
# if you want row-wise, you need to use cov( t(x) )


# for example
  a <- 1:10
  b <- 10:1
  c <- round(rnorm(10,5,25))

  x <- rbind(a, b, a, c)

  columnWise <- cov(x)
  dim(columnWise)
  # [1] 10 10


  rowWise <- cov(t(x))
  dim(rowWise)
  # [1] 4 4
