<p>Delete the corrupt portion preceeding <code>CFS</code> in the header and it works with with <code>read.delim()</code>.</p>

CC BY-SA 4.0
2019-05-08T11:58:25.247Z
Sorry where is the corrupt portion preceeding CFS ?
Zizogolu
CC BY-SA 4.0
2019-05-08T11:59:04.287Z
Everything before it. Just open it in a text editor.
Devon Ryan
CC BY-SA 4.0
2019-05-08T12:39:11.970Z
@DevonRyan Couldn't it be a different encoding used?
llrs
CC BY-SA 4.0
2019-05-08T12:43:16.100Z
@llrs No, there was just a bunch of gibberish. It looks like some other content got added to the front of the file.
Devon Ryan
CC BY-SA 4.0
2019-05-08T12:51:49.350Z
Ok, it's simply when I see this question marks I always suspect of wrong encoding...
llrs
CC BY-SA 4.0
2019-05-08T11:55:09.410Z
2019-05-08T11:55:09.410Z
Devon Ryan
<p>We can skip the first row:</p>

<pre><code>read.delim("txt.txt", skip = 1, header = FALSE)
</code></pre>

<p><strong>Or</strong> we can get the <em>"uncorrupted"</em> version of the table, it looks like it is from <a href="https://doi.org/10.1016/j.celrep.2013.07.003" rel="nofollow noreferrer">this paper</a>, <a href="https://www.sciencedirect.com/science/article/pii/S2211124713003501?via%3Dihub#mmc4" rel="nofollow noreferrer">Table S4</a>.</p>

CC BY-SA 4.0
2019-05-08T20:20:45.290Z
2019-05-08T20:20:45.290Z
zx8754
<p>I am trying to read a txt file in R but always I am getting </p>

<pre><code>Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 113 did not have 10 elements
</code></pre>

<p>I noticed that in the header of my file I have something like </p>

<pre><code> 0000775 €   g¿´�€   4_®™00000016125 13404727020 017402  0                                                                                                    ustar   devons01                        stlab-icgc 
</code></pre>

<p>Even by removing these characters I am not able to read this file</p>

<p>This is link of my file</p>

<p><a href="https://www.dropbox.com/s/rpc5jgti5aa433b/txt.txt?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/rpc5jgti5aa433b/txt.txt?dl=0</a></p>

<p>Could somebody please heap me in reading this file in R?</p>

CC BY-SA 4.0
2019-05-08T20:21:57.523Z
Where is the file from, how was it generated? Looks like an [XY Problem](https://en.wikipedia.org/wiki/XY_problem).
zx8754
<r>
Reading a txt in R with weird header
# Reading a txt in R with weird header

(Asked by: username_0 on 2019-05-08)

I am trying to read a txt file in R but always I am getting 
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 113 did not have 10 elements

I noticed that in the header of my file I have something like 
 0000775 €   g¿´�€   4_®™00000016125 13404727020 017402  0                                                                                                    ustar   devons01                        stlab-icgc 

Even by removing these characters I am not able to read this file
This is link of my file
https://www.dropbox.com/s/rpc5jgti5aa433b/txt.txt?dl=0
Could somebody please heap me in reading this file in R?

**Tags:** r
> **Comments:**
> **username_1**: Where is the file from, how was it generated? Looks like an [XY Problem](https://en.wikipedia.org/wiki/XY_problem).  

---

## 2 answers

### Answer by username_2 on 2019-05-08. Score: 2 | Accepted answer

Delete the corrupt portion preceeding `CFS` in the header and it works with with `read.delim()`.

> **Comments:**
> **username_0**: Sorry where is the corrupt portion preceeding CFS ?  
> **username_2**: Everything before it. Just open it in a text editor.  
> **username_3**: @DevonRyan Couldn't it be a different encoding used?  
> **username_2**: @llrs No, there was just a bunch of gibberish. It looks like some other content got added to the front of the file.  
> **username_3**: Ok, it's simply when I see this question marks I always suspect of wrong encoding...  

---

### Answer by username_1 on 2019-05-08. Score: 3

We can skip the first row:
read.delim("txt.txt", skip = 1, header = FALSE)

Or we can get the "uncorrupted" version of the table, it looks like it is from this paper, Table S4.


---

