-
Notifications
You must be signed in to change notification settings - Fork 9
Using the distance matrices in R
Zarrar Shehzad edited this page May 5, 2017
·
1 revision
After calculating the subject distances, you may want to load those matrices into R to use for your own devious ends. Locate the path to your subject distances output directory.
library(bigmemory)
# Data is arranged as
## rows = flattened distance matrix or nsubs^2
## cols = number of voxels
bigmat <- attach.big.matrix("/path/to/subdist.desc")
dim(bigmat) # can check dimensions
# Get first voxel distance matrix (convert from flattened vector to a square matrix)
# would need to repeat each time
n <- sqrt(nrow(bigmat)) # number of subjects
dmat <- matrix(bigmat[,1], n, n) # Now you can use dmat for your own business.