Hi Margaux,

Check the row.names and col.names arguments of write.table.
See ?write.table

write.table (dat, file = "/path/to/my/data.txt", sep = " ", col.names=FALSE, row.names=FALSE)

HTH,
Ivan


Le 8/1/2011 17:18, Margaux Keller a écrit :
Hi,

I'm trying to create an abbreviated data file from a larger version. I can
use the subset command to create a value for this data:

dat<-subset(raw.data, select=c(SNP, Pvalue))

head (dat)
          SNP Pvalue
1 rs11 0.6516
2 rs12 0.3311
3 rs13 0.5615

but when I try to write.table using:

write.table (dat, file = "/path/to/my/data.txt", sep = " ", col.names=NA)

I end up with a file that looks like this:

"" "SNP" "Pvalue"
"1" "rs11" 0.6516
"2" "rs12" 0.3311
"3" "rs13" 0.5615

when what I want is something that looks like this:

rs11   0.6516
rs12   0.3311
rs13   0.5615

What should I be including?

Thanks,
Margaux

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Dept. Mammalogy
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to