title: Application of 'apply' functions in R
body: <p>I have got the following list which was generated by using split function with state as index.</p>
  
  <pre><code> $AK
                     Hospital_Name         State     Mortality_Rate
    99  PROVIDENCE ALASKA MEDICAL CENTER    AK           13.4
   100   MAT-SU REGIONAL MEDICAL CENTER    AK           17.7
   102      FAIRBANKS MEMORIAL HOSPITAL    AK           15.5
  
   $AL
                                   Hospital_Name        State   Mortality_Rate
    1                 SOUTHEAST ALABAMA MEDICAL CENTER    AL           14.3
    2                    MARSHALL MEDICAL CENTER SOUTH    AL           18.5
    3                   ELIZA COFFEE MEMORIAL HOSPITAL    AL           18.1
  
  
  $AR
                               Hospital_Name       State   Mortality_Rate
   193           SILOAM SPRINGS MEMORIAL HOSPITAL    AR           15.6
   194            JOHNSON REGIONAL MEDICAL CENTER    AR           16.9
   195 WASHINGTON REGIONAL MED CTR AT NORTH HILLS    AR           15.2
  </code></pre>
  
  <p>I want to select Hospital Name of 2nd row from each of these states. Can somebody help with an apply function here? I was trying to use sapply the following way(not working) - </p>
  
  <pre><code>       x &lt;- sapply(test.case3,function(i) test.case3[[i]][2,1])
  </code></pre>
  
  <p>so that, by varying 'i', I can get result as follows - </p>
  
  <pre><code>   &gt; test.case3[[1]][2,1]
      [1] "MAT-SU REGIONAL MEDICAL CENTER"
     &gt; test.case3[[2]][2,1]
      [1] "MARSHALL MEDICAL CENTER SOUTH"
     &gt; test.case3[[3]][2,1]
      [1] "JOHNSON REGIONAL MEDICAL CENTER"
  </code></pre>
  
  <p>Kindly advise.</p>
  
  <p>I required to produce the final report in the following format.(ignore the data, in below example)</p>
  
  <pre><code>       Hospital_Name                    State
      D W MCMILLAN MEMORIAL HOSPITAL       AL
     ARKANSAS METHODIST MEDICAL CENTER     AR
     JOHN C LINCOLN DEER VALLEY HOSPITAL   AZ
  </code></pre>