Merging of datasets from same tissue/region
1
0
Entering edit mode
7.1 years ago
zizigolu ★ 4.3k

Hi,

I have six data sets from different platforms, I annotated probs in each data to gene symbole. I want to merge them like so I have six data sets with the same gene symbols in rows. I used intertection but data sets returned NA. how to match these data?

I thought about merging one by one

merge(data1,data2,by="first col.name")

then extracting each data from merged one but that returned a data without genes in rows

when I tried to merge all

> merge=merge(data1,data2,data3,data4,data5,data6,by="ID")
Error in fix.by(by.x, x) : 
  'by' must specify one or more columns as numbers, names or logical

but all have ID in first col.name

I should merged one by one but

merged=merge(data1,data2,by="first col.name")

data1=merged[,1:43]

data2=merged[1,44:150]  gives just one observation
.

.
R • 3.1k views
ADD COMMENT
0
Entering edit mode

To merge dataframes (DF) by row names, use DF=merge(DF1,DF2,by="row.names"). Also, you cannot merge multiple DF like this unless you store them into a list. Make a loop and iterate on each DF you want to merge or create a list of DF and use join_all function from plyr package (https://www.rdocumentation.org/packages/plyr/versions/1.8.4/topics/join_all).

ADD REPLY
0
Entering edit mode

thank you,

I can exteact DF1 from DF by DF1=DF[,1:42] but for extracting DF2 ----> DF2=DF[1,43:150] gives only one observation and DF2=DF[,43:150] gives no genes in rows. how extract DF2 which contains row names also?

ADD REPLY
1
Entering edit mode

I don't understand what kind of structure do want to process and obtain. I mean, it seems like your DF is already merged so why sub-setting DF1 with the first 42 columns and DF2 with other columns but a single line?

ADD REPLY
0
Entering edit mode

because I need each of DF1 and DF1 independently

ADD REPLY
2
Entering edit mode
7.1 years ago
theobroma22 ★ 1.2k

DF2 <- DF[ , c(1, 43:150)]

ADD COMMENT

Login before adding your answer.

Traffic: 1872 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6