title: Shapiro.test in R giving "all x values are identical"?
body: <p>I've been working on getting a table of shapiro-wilkes normality hypothesis test p-values on a data frame of mine. Here is the data frame (named "mdf1") as a <a href="https://docs.google.com/file/d/0B2MwC8Vr-SXnVmFyMHBWZ2Vtc0U/edit?usp=sharing" rel="nofollow">comma-delimeted CSV</a>.</p>
  
  <p>Shapiro-Wilkes testing in R requires a sample size greater than 3. In order to subset my data frame (which contains two pertinent factors, "variable", and "Site"), I used the following code:</p>
  
  <pre><code>    Z &lt;- as.data.frame(data.table(mdf1)[, list(freq=.N, value=value), by=list(Site,variable)][freq &gt; 3])
  </code></pre>
  
  <p>This resulted in the data frame "Z" which contained all values which belonged to a "Site"*"variable" combination of n greater than 3. Then, I try to pass Z to the <code>ddply</code> function to obtain a table of shapiro-wilkes p-values:</p>
  
  <pre><code>    norm2 &lt;- ddply(Z, .(Site, variable), summarize, n=length(value), sw=shapiro.test(value)[2])
  </code></pre>
  
  <p>The result of this command is:</p>
  
  <p><code>Error in shapiro.test(val) : all 'x' values are identical</code> </p>
  
  <p>How can that be? Any thoughts?</p>