writeSNPMaP {SNPMaP}R Documentation

Write a SNPMaP object to a text file

Description

Transfer the data in a SNPMaP object to a text file (and read the file back into R efficiently).

Usage

writeSNPMaP(x, file="", mm=FALSE, sep="\t", dec=".", transpose=TRUE, ...)
readSNPMaP(file="", sep="\t", dec=".", transpose=TRUE, ...)

Arguments

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.

Details

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.

Value

writeSNPMaP returns TRUE invisibly on success. readSNPMaP returns a named matrix.

See Also

SNPMaP-package

Examples

## 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)

[Package SNPMaP version 1.0.2 Index]