Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

writing to a tab-delimited file or a csv file

Tags:

r

export

csv

I have a RMA normalized data ( from the CEL files ) and would like to write it into a file that I could open in excel but have some problems.

library(affy)
cel <- ReadAffy()
pre<-rma(cel)
write.table(pre, file="norm.txt", sep="\t")
write.table(pre, file="norma.txt")

The outut is arranged row-wise in the text file that is written using the above command and hence when exported to excel it is in a wrong form and many of the information is cut off as the maximum rows are used up .The output looks the following way :

GSM 133971.CEL 5.85302 3.54678 6.57648 9.45634
GSM 133972.CEL 4.65784 3.64578 3.54213 7.89566
GSM 133973.CEL 6.78543 3.54623 2.54345 7.89767   

How to write it in a proper format from CEL files in R to a notepad or excel ?

like image 833
Stacey John Avatar asked Dec 15 '25 17:12

Stacey John


1 Answers

You need to extract the values from the normalised probes using the exprs function. Something like:

write.csv(exprs(pre), file="output.csv", row.names=FALSE)

should do the trick.

like image 97
csgillespie Avatar answered Dec 17 '25 13:12

csgillespie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!