How to import data to R
5
@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
@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
@xlyan011-9805
Last seen 8.8 years ago
Thank you, Sora.
@xlyan011-9805
Last seen 8.8 years ago
Thank you, Sora.
@xlyan011-9805
Last seen 8.8 years ago
Thank you, Sora.
@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
Login before adding your answer.
Traffic: 648 users visited in the last hour