writeSNPMaP {SNPMaP} | R Documentation |
Transfer the data in a SNPMaP object to a text file (and read the file back into R efficiently).
writeSNPMaP(x, file="", mm=FALSE, sep="\t", dec=".", transpose=TRUE, ...) readSNPMaP(file="", sep="\t", dec=".", transpose=TRUE, ...)
x |
object of class SNPMaP . |
file |
character; name of the file that should be created or appended to. The default, "", causes the output to be written to the console. |
mm |
logical indicating whether the data in the mismatch slot should be returned instead. |
sep |
character; the separator to be used between columns in the file. |
dec |
character; the decimal point to be used. |
transpose |
logical; should the data frame be transposed for writing to file (or transposed when reading from file)? |
... |
additional arguments passed to methods. |
transpose
defaults to TRUE
because it is much faster to write one
(or a few) row(s) per chip than it is to write one row per SNP. It also produces smaller text files.
Set transpose=FALSE
to preserve the orientation of the matrix. Likewise, readSNPMaP
assumes
the file was written using the default transpose=TRUE
; change this to FALSE
to read in an
untransposed file.
writeSNPMaP
returns TRUE
invisibly on success. readSNPMaP
returns a named matrix.
## Not run: ## Write to a tab-delimited file writeSNPMaP(x, file='mySNPMaP.dat') ## Write to a csv file writeSNPMaP(x, file='mySNPMaP.csv', sep=',') ## Write a semicolon delimited file with commas for decimal points ## (Standard in some parts of Western Europe) writeSNPMaP(x, file='mySNPMaP.csv', sep=';', dec=',') ## Read a tab-delimited file written using writeSNPMaP() y<-readSNPMaP(file='mySNPMaP.dat') ## End(Not run)