title: Two way crossed anova in R
body: <p>How can I do two way crossed anova in R, as has been performed on these pages: </p>
  
  <p><a href="http://www.itl.nist.gov/div898/handbook/ppc/section2/ppc232.htm" rel="nofollow">http://www.itl.nist.gov/div898/handbook/ppc/section2/ppc232.htm</a></p>
  
  <p><a href="http://www.itl.nist.gov/div898/handbook/ppc/section2/ppc2321.htm" rel="nofollow">http://www.itl.nist.gov/div898/handbook/ppc/section2/ppc2321.htm</a></p>
  
  <p>The data is as follows:</p>
  
  <pre><code>&gt; dput(mydf)
  structure(list(coolant = c("A", "A", "A", "A", "A", "B", "B", 
  "B", "B", "B"), M1 = c(0.125, 0.127, 0.125, 0.126, 0.128, 0.124, 
  0.128, 0.127, 0.126, 0.129), M2 = c(0.118, 0.122, 0.12, 0.124, 
  0.119, 0.116, 0.125, 0.119, 0.125, 0.12), M3 = c(0.123, 0.125, 
  0.125, 0.124, 0.126, 0.122, 0.121, 0.124, 0.126, 0.125), M4 = c(0.126, 
  0.128, 0.126, 0.127, 0.129, 0.126, 0.129, 0.125, 0.13, 0.124), 
      M5 = c(0.118, 0.129, 0.127, 0.12, 0.121, 0.125, 0.123, 0.114, 
      0.124, 0.117)), .Names = c("coolant", "M1", "M2", "M3", "M4", 
  "M5"), class = "data.frame", row.names = c(NA, -10L))
  &gt; 
  &gt; mydf
     coolant    M1    M2    M3    M4    M5
  1        A 0.125 0.118 0.123 0.126 0.118
  2        A 0.127 0.122 0.125 0.128 0.129
  3        A 0.125 0.120 0.125 0.126 0.127
  4        A 0.126 0.124 0.124 0.127 0.120
  5        A 0.128 0.119 0.126 0.129 0.121
  6        B 0.124 0.116 0.122 0.126 0.125
  7        B 0.128 0.125 0.121 0.129 0.123
  8        B 0.127 0.119 0.124 0.125 0.114
  9        B 0.126 0.125 0.126 0.130 0.124
  10       B 0.129 0.120 0.125 0.124 0.117
  </code></pre>
  
  <p>Thanks for your help.</p>
  
  <p>Edit: I tried following but I am not sure if it is correct:</p>
  
  <pre><code>&gt; mm = melt(mydf, id='coolant')
  &gt; aov.out = aov(value~variable + Error(coolant), data=mm)
  &gt; aov.out
  
  Call:
  aov(formula = value ~ variable + Error(coolant), data = mm)
  
  Grand Mean: 0.12404
  
  Stratum 1: coolant
  
  Terms:
                  Residuals
  Sum of Squares   3.92e-06
  Deg. of Freedom         1
  
  Residual standard error: 0.001979899
  
  Stratum 2: Within
  
  Terms:
                    variable  Residuals
  Sum of Squares  0.00030332 0.00036068
  Deg. of Freedom          4         44
  
  Residual standard error: 0.002863088
  Estimated effects may be unbalanced
  &gt; 
  &gt; summary(aov.out)
  
  Error: coolant
            Df   Sum Sq  Mean Sq F value Pr(&gt;F)
  Residuals  1 3.92e-06 3.92e-06               
  
  Error: Within
            Df    Sum Sq   Mean Sq F value   Pr(&gt;F)    
  variable   4 0.0003033 7.583e-05   9.251 1.63e-05 ***
  Residuals 44 0.0003607 8.200e-06                     
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  &gt; 
  </code></pre>