title: creating a table from plain text with multi line entries in r
body: <p>I have a PDF file with a table. I am using <code>pdftools::pdf_text</code> function to extract the text and I get a vector with several lines which represent the table.</p>
  
  <p>My problem is, that there are only spaces and some cells have multiple lines. I am looking for a strategy to get this into a data frame. I played a bit with <code>data.table(text='')</code> but this is complaining about mismatching number of elements per row.</p>
  
  <pre><code> Name                             Separator Description
   Protein IDs                                Identifier(s) of protein(s) contained in the protein group. They
                                              are sorted by number of identified peptides in descending
                                              order.
   Majority protein IDs                       These are the IDs of those proteins that have at least half of
                                              the peptides that the leading protein has.
   Peptide counts (all)                       Number of peptides associated with each protein in protein
                                              group, occuring in the order as the protein IDs occur in the
                                              'Protein IDs' column. Here distinct peptide sequences are
                                              counted. Modified forms or different charges are counted as
                                              one peptide.
  </code></pre>
  
  <p>Here is the data</p>
  
  <pre><code>my_lines &lt;- c("     Name                             Separator Description", 
  "    Protein IDs                                Identifier(s) of protein(s) contained in the protein group. They", 
  "                                               are sorted by number of identified peptides in descending", 
  "                                               order.", "    Majority protein IDs                       These are the IDs of those proteins that have at least half of", 
  "                                               the peptides that the leading protein has.", 
  "    Peptide counts (all)                       Number of peptides associated with each protein in protein", 
  "                                               group, occuring in the order as the protein IDs occur in the", 
  "                                               'Protein IDs' column. Here distinct peptide sequences are", 
  "                                               counted. Modified forms or different charges are counted as", 
  "                                               one peptide."
  )
  </code></pre>
  
  <p><strong>EDIT:</strong><br>
  my expected Output would be a data frame like this:</p>
  
  <pre><code>                  Name Separator
  1          Protein IDs          
  2 Majority protein IDs          
  3 Peptide counts (all)          
                                                                                                                                                                                                                                                   Description
  1                                                                                                                          Identifier(s) of protein(s) contained in the protein group. They are sorted by number of identified peptides in descending order.
  2                                                                                                                                                  These are the IDs of those proteins that have at least half of the peptides that the leading protein has.
  3 Number of peptides associated with each protein in protein group, occuring in the order as the protein IDs occur in the 'Protein IDs' column. Here distinct peptide sequences are counted. Modified forms or different charges are counted as one peptide.
  </code></pre>
  
  <p><strong>EDIT2:</strong><br>
  so playing with <code>readr::read_fwf()</code> I got a bit closer with the following code (I didn't played much attention to the start and end points of the column, just tested it). </p>
  
  <pre><code>writeLines(my_lines, 'test.txt')
  readr::read_fwf('test.txt', 
                  fwf_positions(c(1, 30, 45), c(29, 42, 300), 
                                c("Name", "Separator", "Description")),
                  skip=1)
  </code></pre>
  
  <p>Problem here is, I get Gas for the empty lines within <code>Name</code> column. Since the <code>Description</code> column has multiple lines it also expects a value for <code>Name</code> but there is none.</p>