title: Find the summary based on the another column in R
body: <p>I have a data set which has 5 columns in it. In one column there is date, in second column there is surface data, in 3rd column bottom , in 4th id and in 5th diff . </p>
  
  <p>For example I have a simple data as follows:</p>
  
  <pre><code>         Date   Surface Bottom  id  diff
  250.0416718 17.49998283 17.50068474 apple   0.00070191
  250.0833282 17.50042152 17.50049591 apple   7.44E-05
  250.125 17.50060844 17.50074196 apple   0.00013352
  250.1666718 17.50083923 17.50092125 apple   8.20E-05
  250.2083282 17.50104713 17.50112343 apple   7.63E-05
  250.25  17.50044441 17.50311279 apple   0.00266838
  250.2916718 17.50193024 17.50263214 apple   0.0007019
  250.3333282 17.50139427 17.50404167 apple   0.0026474
  250.375 17.50112724 17.50495529 apple   0.00382805
  250.4166718 17.50050163 17.50526428 apple   0.00476265
  250.4583282 17.4996891  17.5043335  apple   0.0046444
  250.5   17.50051117 17.50292969 apple   0.00241852
  250.5416718 17.50112534 17.50325584 apple   0.0021305
  250.5833282 17.50115585 17.50579262 apple   0.00463677
  250.625 17.49997902 17.51161766 apple   0.01163864
  250.6666718 17.50042725 17.51110268 apple   0.01067543
  250.7083282 17.50220871 17.51453209 apple   0.01232338
  250.75  17.50037193 17.51698685 apple   0.01661492
  250.7916718 17.49991035 17.51932716 apple   0.01941681
  250.8333282 17.49968529 17.51773262 apple   0.01804733
  250.875 17.49991989 17.51846504 apple   0.01854515
  250.9166718 17.50037575 17.51842499 apple   0.01804924
  250.9583282 17.50083351 17.5181942  apple   0.01736069
  250.0416718 17.4834671  17.52766609 orange  0.04419899
  250.0833282 17.50394249 17.50412369 orange  0.0001812
  250.125 17.50208092 17.50209427 orange  1.33E-05
  250.1666718 17.50076485 17.50090981 orange  0.00014496
  250.2083282 17.50046158 17.50056648 orange  0.0001049
  250.25  17.50087547 17.50146103 orange  0.00058556
  250.2916718 17.50173569 17.50222969 orange  0.000494
  250.3333282 17.50191689 17.503088   orange  0.00117111
  250.375 17.50203133 17.50272942 orange  0.00069809
  250.4166718 17.50189781 17.50306129 orange  0.00116348
  250.4583282 17.50161171 17.50306129 orange  0.00144958
  250.5   17.50050735 17.50379753 orange  0.00329018
  250.5416718 17.50190926 17.50399017 orange  0.00208091
  250.5833282 17.49914932 17.5080471  orange  0.00889778
  250.625 17.4993763  17.51009941 orange  0.01072311
  250.6666718 17.50062752 17.50571442 orange  0.0050869
  250.7083282 17.50298119 17.50680923 orange  0.00382804
  250.75  17.50000572 17.51567268 orange  0.01566696
  250.7916718 17.49908829 17.52041054 orange  0.02132225
  250.8333282 17.49832535 17.52310562 orange  0.02478027
  250.875 17.50114822 17.5190239  orange  0.01787568
  250.9166718 17.50248909 17.51517487 orange  0.01268578
  250.9583282 17.50420952 17.51499939 orange  0.01078987
  250.0416718 17.48648453 17.54705238 banana  0.06056785
  250.0833282 17.49559593 17.51511574 banana  0.01951981
  250.125 17.50065994 17.50082779 banana  0.00016785
  250.1666718 17.49912643 17.50104332 banana  0.00191689
  250.2083282 17.49981308 17.50061226 banana  0.00079918
  250.25  17.48498726 17.51077271 banana  0.02578545
  250.2916718 17.50126648 17.50265312 banana  0.00138664
  250.3333282 17.50064278 17.50525475 banana  0.00461197
  250.375 17.49790573 17.5075798  banana  0.00967407
  250.4166718 17.49773407 17.50739861 banana  0.00966454
  250.4583282 17.49995041 17.50810432 banana  0.00815391
  250.5   17.50090981 17.50782394 banana  0.00691413
  250.5416718 17.49921417 17.50924492 banana  0.01003075
  250.5833282 17.50100517 17.50682259 banana  0.00581742
  250.625 17.49917221 17.51366425 banana  0.01449204
  250.6666718 17.49997902 17.516119   banana  0.01613998
  250.7083282 17.49642563 17.52497673 banana  0.0285511
  250.75  17.50387573 17.52059746 banana  0.01672173
  250.7916718 17.49860764 17.52764511 banana  0.02903747
  250.8333282 17.49892616 17.52431297 banana  0.02538681
  250.875 17.49625969 17.51802826 banana  0.02176857
  250.9166718 17.49425125 17.51676941 banana  0.02251816
  250.9583282 17.49142265 17.51862717 banana  0.02720452
  250.0416718 17.49982834 17.50016785 Pomogranate 0.00033951
  250.0833282 17.50012589 17.5002079  Pomogranate 8.20E-05
  250.125 17.50020981 17.50033951 Pomogranate 0.0001297
  250.1666718 17.50007057 17.50069427 Pomogranate 0.0006237
  250.2083282 17.50011444 17.50080299 Pomogranate 0.00068855
  250.25  17.49681091 17.49951553 Pomogranate 0.00270462
  250.2916718 17.46898651 17.50089264 Pomogranate 0.03190613
  250.3333282 17.45019341 17.5055275  Pomogranate 0.05533409
  250.375 17.45742989 17.50874901 Pomogranate 0.05131912
  250.4166718 17.46098709 17.50691414 Pomogranate 0.04592705
  250.4583282 17.46137619 17.5025692  Pomogranate 0.04119301
  250.5   17.45593262 17.50370407 Pomogranate 0.04777145
  250.5416718 17.45370865 17.50605965 Pomogranate 0.052351
  250.5833282 17.45739937 17.50655365 Pomogranate 0.04915428
  250.625 17.4641552  17.49952126 Pomogranate 0.03536606
  250.6666718 17.46249771 17.49928856 Pomogranate 0.03679085
  250.7083282 17.46813965 17.49975586 Pomogranate 0.03161621
  250.75  17.47341919 17.50149536 Pomogranate 0.02807617
  250.7916718 17.47782135 17.50320625 Pomogranate 0.0253849
  250.8333282 17.47783089 17.50071907 Pomogranate 0.02288818
  250.875 17.47754288 17.50206757 Pomogranate 0.02452469
  250.9166718 17.47626305 17.50252533 Pomogranate 0.02626228
  250.9583282 17.47546768 17.50405693 Pomogranate 0.02858925
  </code></pre>
  
  <p>I want to find the summary of each column "surface", "bottom" and "diff" based on the id from "id" column. I tried to use the code as follows:</p>
  
  <pre><code>jdbaba &lt;- read.csv("statssal.csv")
  summary(jdbaba)
  sapply(jdbaba,summary)
  </code></pre>
  
  <p>But I couldn't figure out to find summary for each id. </p>
  
  <p><strong>EDIT:</strong>
  For Example I want summary of column diff for each id such as apple, orange etc. </p>
  
  <p>The csv data file can be found here <a href="https://www.dropbox.com/s/fxiavvt1eqlkig8/statssal.csv" rel="nofollow">https://www.dropbox.com/s/fxiavvt1eqlkig8/statssal.csv</a></p>
  
  <p>Thanks.</p>