<p>In R:</p>

<pre class="lang-r prettyprint-override"><code>flist = list.files("*.txt", path=".")
fl = lapply(flist, function(x) read.delim(x, header=F))
m = sapply(fl, function(x) x$V2)
row.names(m) = fl[[1]]$V1
colnames(m) = flist
</code></pre>

<p>That will give you an appropriately formatted matrix named <code>m</code> in R, which is probably where you want to continue processing things anyway.</p>

CC BY-SA 3.0
2018-01-23T11:18:07.663Z
Let me try thanks for the quick solution  , i was trying shell script based but couldn't able
kcm
CC BY-SA 3.0
2018-01-23T11:11:15.057Z
2018-01-23T11:11:15.057Z
Devon Ryan
<p>I have downloaded harmonised the TCGA-HNSC dataset and extracted it. It has 546 samples in total, so what I see in it are FPKM normalised values. The first column remains the same with 60000 rows and 2 columns that is first column ENSEMBL ID and second column FPKM value.</p>

<p>So now the issue is I want to join all the 546 txt file into one where the first column remains the same and rest 546 column would be joined. I'm using this command:</p>

<pre><code>paste -d " " *txt &gt; merged_file.txt
</code></pre>

<p>This is joining the all the data sets as ENSEMBL ID and FPKM value..</p>

<p>But I want 1st column as the ENSEMBLE ID and rest the sample FPKM any suggestion or help would be appreciated </p>

<rna-seq>
TCGA data sets joining multiple files
# TCGA data sets joining multiple files

(Asked by: username_0 on 2018-01-23)

I have downloaded harmonised the TCGA-HNSC dataset and extracted it. It has 546 samples in total, so what I see in it are FPKM normalised values. The first column remains the same with 60000 rows and 2 columns that is first column ENSEMBL ID and second column FPKM value.
So now the issue is I want to join all the 546 txt file into one where the first column remains the same and rest 546 column would be joined. I'm using this command:
paste -d " " *txt > merged_file.txt

This is joining the all the data sets as ENSEMBL ID and FPKM value..
But I want 1st column as the ENSEMBLE ID and rest the sample FPKM any suggestion or help would be appreciated

**Tags:** rna-seq

---

## 1 answers

### Answer by username_1 on 2018-01-23. Score: 2 | Accepted answer

In R:
flist = list.files("*.txt", path=".")
fl = lapply(flist, function(x) read.delim(x, header=F))
m = sapply(fl, function(x) x$V2)
row.names(m) = fl[[1]]$V1
colnames(m) = flist

That will give you an appropriately formatted matrix named m in R, which is probably where you want to continue processing things anyway.

> **Comments:**
> **username_0**: Let me try thanks for the quick solution  , i was trying shell script based but couldn't able  

---

