I'm trying to cluster 3D data that I have in an array. It's actually information from a 3D image so this array represents a single image with x,y,z values. I would like to know what voxel tends to cluster with what. The array looks like this.
dim(x)
[1] 34 34 34 1
How can I go about this? I tried just plotting with scatterplot3d but it did not work.
So this is an attempt at clustering. You really should provide data if you want a better answer.
The main idea is to reshape your 3D matrix into "long" format with columns for x, y, z, and the actual matrix values. So now x, y, and z contain the positional information (here, the index values 1:10). You need to scale this so the
value
column and the index columns are on the same scale, otherwise clustering will give you misleading results.