title: functions for matrices / cluster analysis
body: <p>I have the following problem. Maybe you can help me!</p>
  
  <p>I have 60 matrices (60 trials). Each of those matrices is 16*1000 fileds big (16 angles and 1000 timestamps). The 16 angels are bodyangels.</p>
  
  <p>Now I want to calculate the euclicid distance for each of the combinations (1770). So I would get 1770 matrices which are are 16*1000 fileds big.
  The list for every combinations I would get through this formula:</p>
  
  <pre><code>&gt;comb &lt;- combinations(n=60, r=2, v=n, set=TRUE, repeats.allowed=FALSE)
  </code></pre>
  
  <p>The formula which I want to apply to each of these combinations is:</p>
  
  <pre><code>&gt; dab &lt;- sqrt(sum((a-b)^2)) # a and b are two matrices
  </code></pre>
  
  <p>I tried to create a function, which is fortunately only for single values, but not for whole matrices.:</p>
  
  <pre><code>&gt;dist.fun &lt;- function(x,y)
  &gt;{
  &gt;z &lt;- sqrt(sum((x)-(y))^2)
  &gt;    return(z)
  &gt;}
  </code></pre>
  
  <p>Out of those distances I want to create an euclidic distance matrix to do a cluster analysis.</p>
  
  <pre><code>&gt;plot(hclust((as.dist(m)),method="ward.D2")) # m is the euclidic disdance matrix
  </code></pre>
  
  <p>I hope, anyone can help me with this problem. The data is biomechanical data from gymnasts, which I want to investigate in terms of variant and invariant components and prototypes. </p>