title: Reading non delimited text file into R
body: <p>I have a large set of <a href="http://www.thearda.com/public/American%20National%20Election%20Studies,%20Cumulative%20Data%20File,%201948-2004-DAT.exe" rel="nofollow">Data</a> that is in an non delimited format that I am trying  to import into <strong>R</strong>.  The data set comes with a <a href="http://www.thearda.com/download/download.aspx?file=American%20National%20Election%20Studies,%20Cumulative%20Data%20File,%201948-2004.COL" rel="nofollow">Column Locations</a> file that includes a row number, the column name, and the character position of the variable.  Is there an existing package for handling this type of data? If not, how can it be done?</p>
  
  <p>Final Code I used to parse the widths from the Column Locations file and use them to read the Data file:</p>
  
  <pre><code>ColumnNames_Download &lt;- function(){
   if(file.exists("ANES_ColumnNames.txt")){
        columnNames &lt;- read_delim("ANES_ColumnNames.txt", delim = " ")
   } else{
        download.file(ANES_ColNamesURL, "ANES_ColumnNames.txt", mode = "wb")
        columnNames &lt;- read_delim("ANES_ColumnNames.txt", delim = " ")
   }
   return(columnNames)
  </code></pre>
  
  <p>}</p>
  
  <pre><code>ColumnWidths &lt;- function(columnNames){
   columnNames_list &lt;- columnNames$File
   columnNames_listSub &lt;- gsub(pattern = "-", replacement = ":",
                             x = columnNames_list)
   columnNames_split &lt;- strsplit(columnNames_listSub, split = ":")
   columnWidth &lt;- vector()
   for (i in seq_along(columnNames_split)){
        if (length(columnNames_split[[i]]) &gt; 1){
             columnWidth &lt;- append(columnWidth,c(as.numeric(
                            columnNames_split[[i]][2]) - 
                            as.numeric(columnNames_split[[i]][1]) + 1))
        } else{
             columnWidth &lt;- append(columnWidth,c(1))
  
        }
  
   }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>Data_Download &lt;- function(Width){
   read_fwf("ANES_Data.txt",fwf_widths(Width))
  </code></pre>
  
  <p>}</p>