title: R - create multi-level list
body: <p>Ok this is very basic, but I am trying to create a 'nested' (2-level) list in R.</p>
  
  <p>I have four files referenced to like this:</p>
  
  <pre><code>files=c('path-to-file1',
          'path-to-file2',
          'path-to-file3',
          'path-to-file4') 
  </code></pre>
  
  <p>On the other hand, I have four different operations that I need to perform on each file:</p>
  
  <pre><code>ops=c('operation1,
         operation2,
         operation3,
         operation4')
  </code></pre>
  
  <p>I am doing two "for" loops (one over files and one over operations), and therefore I need to populate a two-level list that needs to be organized like this:</p>
  
  <pre><code>  - the 1st element of the first level is "file1";
      - the 1st element of the second level is "operation1"
      - the 2nd element of the second level is "operation2"
      - the 3nd element of the second level is "operation3"
      - the 4nd element of the second level is "operation4"
  
    - the 2nd element of the first level is "file2";
      - the 1st element of the second level is "operation1"
      - the 2nd element of the second level is "operation2"
      - the 3nd element of the second level is "operation3"
      - the 4nd element of the second level is "operation4"
  
    - and so on...
  </code></pre>
  
  <p>What is the best way to create a multi-level list like this?</p>
  
  <p>EDIT: This is kind of what I am looking for:</p>
  
  <pre><code>files=c('path-to-file1',
          'path-to-file2',
          'path-to-file3',
          'path-to-file4')
  
  ops=c('operation1,
         operation2,
         operation3,
         operation4')
  
  # Create empty list to hold "operations" objects
  list.ops = vector('list', length(ops))
  
  # Create multi-level list lo hold both "files" and "operations" objects
  multi.list = ? (how to create it? see loops below)
  
  for (i in 1:length(files)){
  
    for (j in 1:length(ops)){
  
      (do some stuff)
  
      list.ops[[j]] = result of some operations
  
    }
      multi.list[[i]][[j]] = list.ops[[j]]
  }
  </code></pre>