title: ggplot2 scatter plot with overlay of means and bidirectional SD bars
body: <p>This question is a direct successor to a pervious question asked here called “ggplot scatter plot of two groups with superimposed means with X and Y error bars”.  That questions answer looks to do exactly what I am trying to accomplish however the code provided results in an error which I can’t get around.  I will use my data as example here but I have tried the original question code as well with the same result.
  I have a data frame which looks like this:</p>
  
  <pre><code>structure(list(Meta_ID = structure(c(15L, 22L, 31L, 17L), .Label = c("NM*624-46", 
  "NM*624-54", "NM*624-56", "NM*624-61", "NM*624-70", "NM624-36", 
  "NM624-38", "NM624-39", "NM624-40", "NM624-41", "NM624-43", "NM624-46", 
  "NM624-47", "NM624-51", "NM624-54 ", "NM624-56", "NM624-57", 
  "NM624-59", "NM624-61", "NM624-64", "NM624-70", "NM624-73", "NM624-75", 
  "NM624-77", "NM624-81", "NM624-82", "NM624-83", "NM624-84", "NM625-02", 
  "NM625-10", "NM625-11", "SM621-43", "SM621-44", "SM621-46", "SM621-47", 
  "SM621-48", "SM621-52", "SM621-53", "SM621-55", "SM621-56", "SM621-96", 
  "SM621-97", "SM622-51", "SM622-52", "SM623-14", "SM623-23", "SM623-26", 
  "SM623-27", "SM623-32", "SM623-33", "SM623-34", "SM623-55", "SM623-56", 
  "SM623-57", "SM623-58", "SM623-59", "SM623-61", "SM623-62", "SM623-64", 
  "SM623-65", "SM623-66", "SM623-67", "SM680-74", "SM681-16"), class = "factor"), 
  Region = structure(c(1L, 1L, 1L, 1L), .Label = c("N", "S"
  ), class = "factor"), Tissue = structure(c(1L, 2L, 1L, 1L
  ), .Label = c("M", "M*"), class = "factor"), Tag_Num = structure(c(41L, 
  48L, 57L, 43L), .Label = c("621-43", "621-44", "621-46", 
  "621-47", "621-48", "621-52", "621-53", "621-55", "621-56", 
  "621-96", "621-97", "622-51", "622-52", "623-14", "623-23", 
  "623-26", "623-27", "623-32", "623-33", "623-34", "623-55", 
  "623-56", "623-57", "623-58", "623-59", "623-61", "623-62", 
  "623-64", "623-65", "623-66", "623-67", "624-36", "624-38", 
  "624-39", "624-40", "624-41", "624-43", "624-46", "624-47", 
  "624-51", "624-54", "624-56", "624-57", "624-59", "624-61", 
  "624-64", "624-70", "624-73", "624-75", "624-77", "624-81", 
  "624-82", "624-83", "624-84", "625-02", "625-10", "625-11", 
  "680-74", "681-16"), class = "factor"), Lab_Num = structure(1:4, .Label = c("C4683", 
  "C4684", "C4685", "C4686", "C4687", "C4688", "C4689", "C4690", 
  "C4691", "C4692", "C4693", "C4694", "C4695", "C4696", "C4697", 
  "C4698", "C4699", "C4700", "C4701", "C4702", "C4703", "C4704", 
  "C4705", "C4706", "C4707", "C4708", "C4709", "C4710", "C4711", 
  "C4712", "C4713", "C4714", "C4715", "C4716", "C4717", "C4718", 
  "C4719", "C4720", "C4721", "C4722", "C4723", "C4724", "C4725", 
  "C4726", "C4727", "C4728", "C4729", "C4730", "C4731", "C4732", 
  "C4733", "C4734", "C4735", "C4736", "C4737", "C4738", "C4739", 
  "C4740", "C4741", "C4742", "C4743", "C4744", "C4745", "C4746", 
  "C4747", "C4748"), class = "factor"), C = c(46.5, 46.7, 45, 
  43.6), N = c(12.9, 13.7, 14.5, 13.4), C.N = c(3.6, 3.4, 3.1, 
  3.3), d13C = c(-19.7, -19.5, -19.4, -19.2), d15N = c(13.3, 
  12.4, 11.7, 11.9)), .Names = c("Meta_ID", "Region", "Tissue", 
  "Tag_Num", "Lab_Num", "C", "N", "C.N", "d13C", "d15N"), row.names = c(NA, 
  4L), class = "data.frame")
  </code></pre>
  
  <p>What I want to produce is a scatter plot of the raw data with an overlay of the data means for each “Region” with bidirectional error bars.  To accomplish that I use plyr to summarize my data and generate the means and SD’s.  Then I use ggplot2:</p>
  
  <pre><code>library(plyr)
  Basic &lt;- ddply(First.run,.(Region),summarise,
         N = length(d13C),
         d13C.mean = mean(d13C),
         d15N.mean = mean(d15N),
         d13C.SD = sd(d13C),
         d15N.SD = sd(d15N))
  
  ggplot(data=First.run, aes(x = First.run$d13C, y = First.run$d15N))+
   geom_point(aes(colour = Region))+
   geom_point(data = Basic,aes(colour = Region))+ 
   geom_errorbarh(data = Basic, aes(xmin = d13C.mean + d13C.SD, xmax = d13C.mean -         d13C.SD,
                                 y = d15N.mean, colour = Region, height = 0.01))+ 
    geom_errorbar(data = Basic, aes(ymin = d15N.mean - d15N.SD, ymax = d15N.mean + d15N.SD, 
                               x = d13C.mean,colour = Region))
  </code></pre>
  
  <p>But each time I run this code I get the same error and can’t figure out what the problem is.
  Error: Aesthetics must either be length one, or the same length as the dataProblems:Region</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Edit:  Since my example data is taken from the head of my full dataset it only includes samples from the "N" Region.  With only this one region the code works fine but if you use fix() to change the provided dataset so that at least one other Region is included (in my data the other Region is "S") then the error I get shows up.  My mistake in not including some data from each Region.</p>