title: How to extract variable names and variable data from the same lines to make a data frame?
body: <p>I have a series of text files that look like this:</p>
  
  <pre><code>USABILITY DATA
  Level Name: LVL_Introduction
      Time Spent: 323.233307
      Times Teleported: 6
      NumDeaths: 0
  
  Level Name: LVL_1-1
      Time Spent: 36.760727
      Times Teleported: 1
      NumDeaths: 0
  
  Level Name: LVL_1-2
      Time Spent: 45.953598
      Times Teleported: 1
      NumDeaths: 0
  
  Level Name: LVL_1-3
      Time Spent: 176.440704
      Times Teleported: 0
      NumDeaths: 0
  
  Level Name: LVL_1-4
      Time Spent: 281.797485
      Times Teleported: 0
      NumDeaths: 0
  </code></pre>
  
  <p>Each text file represents one player's data from a play session in a puzzle game from level to level. Some players reach different levels than others.</p>
  
  <p>I'd like to scrape this kind of text file into a data frame that would give me a table with the Level Name (ex: "LVL_1-3") as a column header and "Time Spent", "Times Teleported", and "NumDeaths" as the Row Headers.</p>
  
  <pre><code>                    LVL_Introduction    Lvl_1-1    etc...
  Time Spent:         323.233307          36.760727
  Times Teleported:   6                   1 
  NumDeath:           0                   0
  </code></pre>
  
  <p>Ideally, the script would be robust enough to work no matter which user (or level name) is involved. I've seen several different solutions for related problems, some using regular expressions, and some simply splitting strings. I'm not sure the best process to use a single line to make both a header and a data value, in a script that works across multiple files.</p>
  
  <p>Thanks,
  Mitchell</p>