Biostar Beta. Not for public use.
trying to merge two csv lists of genes with biomaRt
0
Entering edit mode
13 months ago
European Union

Is it possible to merge 2 csv file lists of genes using the merge() command? I simply have written the code "merge("a file.csv", "another file.csv") but it's not working any hints?

Thanks

R • 1.3k views
ADD COMMENTlink
0
Entering edit mode

you should specify the argument All =T, check below..

ADD REPLYlink
2
Entering edit mode
4 months ago
RamRS 21k
Houston, TX

Hi,

First off, this is a straight R question, neither biomaRt nor genes is critical here. Honestly, I'm not entirely sure this is a bioinformatics question.

Second, here's how, assuming all you want is to append CSV file B to CSV file A using R: https://kb.iu.edu/d/bcrr

ADD COMMENTlink
0
Entering edit mode

Ram RS,

so this command in the url you posted will merge R list objects that contain some named elements in common?

If so, great!

ADD REPLYlink
0
Entering edit mode

I think so. It reads CSV files into data frames and assuming headers match, merge them. Not sure how it will react to mismatched fields though. Might wanna do a trial or Google a bit more.

ADD REPLYlink
2
Entering edit mode
2.7 years ago
Kizuna • 780
France, Paris

merge(x="a file.csv", y="another file.csv",All=True)

it will merge both files based on common columns.

if you have some specific lines there are the arguments : by.x and by.y where you can specifiy the columns.

ADD COMMENTlink
0
Entering edit mode

Kizuna,

So that command seems to work as it returns this:

       x                y  

1 a file.csv another file.csv

But how do I get R to print the merged list....?

ADD REPLYlink
1
Entering edit mode
2.7 years ago
Kizuna • 780
France, Paris

merged.file=merge(x="a file.csv", y="another file.csv",All=True)

print(merged.file) ; head(merged.file, n=5)

write.table(merged.file,file="merged.file",sep="\t")

ADD COMMENTlink
0
Entering edit mode

Hi Kizuna,

So it appears to be doing something but those commands are still not giving me what I want, it prints:

merged.file=merge(x="aabb.csv", y="another file.csv",All=True)


print(merged.file) ; head(merged.file, n=5)
x y
1 aabb.csv another file.csv
x y
1 aabb.csv another file.csv

and then the last line doesn't print anything....

I saved two excel files as csv files and I am able to retrieve info about the gene lists contained with getBM() but when I type head("a file.csv") it just prints "a file".....

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1