How to import data to R
5
0
Entering edit mode
xlyan011 • 0
@xlyan011-9805
Last seen 8.8 years ago

Hi all,

I have a list of gene names and would like to run a gene enrichment analysis. Does anyone know which kind of file I should use to import these genes to R (CSV? txt? or excel?) Gene lists is everything I needed in this file for further analysis, right?

Thanks,

Bef

annotation • 4.0k views
ADD COMMENT
0
Entering edit mode
yoonsora • 0
@yoonsora-9787
Last seen 8.8 years ago

Hello, Bef!

You can import both .txt and .csv file.

If you have .txt file and it is tab-delimited, would you try to type following lines?

myfile = read.delim('Address of file to be imported', sep="\t")

head(myfile) # Check the impoted data

Or, it you have have .csv file (that are delimeted by comma), please try to type following line.

myfile = read.delim('Address of file to be imported', sep=",")

 

 

Thanks,

 

Sora

 

 

 

 

 

 

 

 

ADD COMMENT
0
Entering edit mode
xlyan011 • 0
@xlyan011-9805
Last seen 8.8 years ago

Thank you, Sora.

ADD COMMENT
0
Entering edit mode
xlyan011 • 0
@xlyan011-9805
Last seen 8.8 years ago

Thank you, Sora.

ADD COMMENT
0
Entering edit mode
xlyan011 • 0
@xlyan011-9805
Last seen 8.8 years ago

Thank you, Sora.

ADD COMMENT
0
Entering edit mode
arfranco ▴ 130
@arfranco-8341
Last seen 6 months ago
European Union

If you want to import data from excel files, you can do it 

library(gdata) 
data <- read.xls(xls="Your_file.xls", sheet = 1, header = TRUE) # You can choose different sheet and have other choices

This library is very straightforward and stable, working very well

ADD COMMENT

Login before adding your answer.

Traffic: 415 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