title: Object not found error
body: <p>Firstly I need to explain that I've had MINIMAL training on R and have 0 knowledge of coding languages or programmes like R so please excuse me if I ask silly questions or don't understand something basic. </p>
  
  <p>Also, I have tried to look at past topics/answers on this but I'm having a hard time relating the answers to my data so I apologise if this question has already been answered. </p>
  
  <p>Basically I have a data set and I'm trying to find the mean of two variables (Peak flow before a walk in the cold, and peak flow after a walk in the cold) in this set. This is the entire code I've used so far: </p>
  
  <pre><code> drugs &lt;- read.table(file = "C:\\Users\\Becky\\My Documents\\Asthmadata.txt", header = TRUE)
  
   drugs
   str(drugs)
  
   mean.Asthmadata &lt;- tapply (Asthmadata$trial1, list(Asthmadata$PEFR1), mean)
   mean.Asthmadata
  </code></pre>
  
  <p>It works fine until the mean.Asthmadata. The data comes up in R just fine with the other codes but when I get to the mean and do the mean.Asthmadata [...] code, I keep getting the same error: "object 'mean.Asthmadata' not found"</p>
  
  <p>My friend used the same code I did and it worked for him so I'm confused. Am I doing something wrong? </p>
  
  <p>Thanks</p>
  
  <p>EDIT: 
  @BenBolker </p>
  
  <p>This is my data set</p>
  
  <pre><code>trial1  PEFR1   trial2  PEFR2
  Before  310 After   299
  Before  242 After   201
  Before  340 After   232
  Before  388 After   312
  Before  294 After   221
  Before  251 After   256
  Before  391 After   327
  Before  401 After   331
  Before  287 After   231
  </code></pre>
  
  <p>And here's all the code I've used: </p>
  
  <pre><code>drugs &lt;- read.table(file = "C:\\Users\\Becky\\My Documents\\Asthmadata.txt", header = TRUE)
  
  drugs
  str(drugs)
  
  mean.drugs &lt;- tapply (drugs$trial1, list(drugs$PEFR1), mean)
  mean.drugs
  </code></pre>
  
  <p>The R version I have has two versions: i386 3.1.3, and x64 3.1.3 – I've tried both but neither seem to do what I want. I'm also using Windows 7 Home Premium 64bit. Hope I've included everything you need and I apologise if my formatting is off – I can't quite figure out how to format properly on here yet.  </p>
  
  <p>And the error I'm getting NOW is: “Error in split.default(X, group) : first argument must be a vector” when running the code Roland kindly provided. So I'm getting a different error each time I try it – it must be something I'm doing wrong. </p>
  
  <p>Hope I've formatted that all correctly and included everything you need. Thanks :)</p>