title: R: Extracting Data Frame from list of CSV file data
body: <p>So I come from a background of Matlab and Python (and several others less related). I'm picking up R for a Coursera course.</p>
  
  <p>I followed this <a href="https://stackoverflow.com/questions/11433432/importing-multiple-csv-files-into-r">SO answer</a> in order to read in all my homework files into a list in a single line of code. My code looks like this:</p>
  
  <pre><code># Get a list of files
  files = list.files(path = dataDir, pattern = '*.csv')
  
  # Import the file data
  setwd(dataDir)
  data = lapply(files, read.csv)
  </code></pre>
  
  <p>This all works just fine. However, I am getting a object back that I don't know how to access. I mentioned Matlab and Python before because I've attempted to access the data in all the ways I would in those languages.</p>
  
  <p>Here's what summary output:</p>
  
  <pre><code>summary(data)
         Length Class      Mode
    [1,] 4      data.frame list
    [2,] 4      data.frame list
    [3,] 4      data.frame list
  </code></pre>
  
  <p>There are actually 352 of them not just 3 but no one needs a listing of all 352. Here's what <code>summary</code> of an individual index outputs:</p>
  
  <pre><code>summary(data[200])
       Length Class      Mode
  [1,] 4      data.frame list
  </code></pre>
  
  <p>So if I enter <code>data[200]</code> I get listing of the first 2500 rows of data. But <code>data[200, 100]</code> returns as error as does <code>data[200][,100]</code> and <code>data[200][100,]</code>. <code>data[200][100]</code> returns <code>[[1]] NULL</code>.</p>
  
  <p>While I haven't fully considered what I will need to do for this homework I'm sure it will involve calculating means/medians/maximum/etc of all non-NA values in various data columns. This wasn't tough to do for the quizzes using something like <code>mean(data[which(is.na('Col1')==F), 'Col6'])</code>.</p>
  
  <p>So I imagine I could use a more hackish version of what I need where I simply load the 1 file I need at the time I need it, extract only the portion of the data frame I need right then, and loop over all the data files I need to process. However, I'd rather know how to access the data in the object R creates from the <code>lapply</code> line. I suspect this will make more complex analyses later on much easier to code.</p>
  
  <p>Thanks</p>