how to import dat file in R
<p>I have a <code>dat.</code> file containing one really long line. I have the specific layout to read the data but I do not know how.</p>
<p>What I have done so far(based on searhes in other posts) is try to use readLines, <code>read.fwf</code>, and also I tried to copy that line into one vector which later to split according to the logic in the layout but with no success. All of the approaches seem to encounter a problem with the length of the line in question which composes the entire dat. file</p>
<p>Any suggestions are appreciated!</p>
<p>PS: I am a beginner in R</p>
<p>I think it will be good to add an example so here it comes:</p>
<p>If we have a text file containing a single line as follows:</p>
<pre><code>1 a 5 2 b 6 3 c 7
</code></pre>
<p>and we have the layout, in this case we need three variables with length 1 - the first one numeric, the second - string and the third one - numeric again</p>
<p>the imported data frame should look like:</p>
<pre><code>1 a 5

2 b 6

3 c 7

3 rows, 3 columns
</code></pre>