Description Usage Arguments Details Value See Also Examples
read.snps
is wrapper around scan
that also converts into native matrix format.
1 2 |
file |
Filename or connection. |
ncols |
Integer, number of columns in |
na |
Missing values; entries with this value are replaced with |
what |
The typeof of data to be read, e.g. |
extractIDs |
Logical, default |
quiet |
logical: if |
... |
Passed on to |
Assumes a file format with no header and first column are IDs. If no ID column, use extractIDs = FALSE
.
Usually white-space delimted, but separator can be set with sep
argument as per scan
.
For file format example see Siccuracy.
If ID columns contains alphabetical elements, use what=character()
. This will however return a character matrix.
Use e.g. storage.mode(m) <- 'integer'
to convert to integer-based, keeping all other attributes.
Native matrix.
write.snps
, typeof, get_ncols
, scan
,
and Oxford, SHAPEIT, and VCF formats.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Make test data
tmpfile <- tempfile()
write.snps(Siccuracy:::make.true(5, 10), tmpfile)
M <- read.snps(tmpfile)
# Process the genotypes in chunks:
# Setting mode to 'r' is very important to avoid resetting the pointer at file head!
ncols <- get_ncols(tmpfile)
f <- file(tmpfile, 'r')
while (TRUE) {
M <- read.snps(f, nlines=500, ncols=ncols)
if (nrow(M) == 0) break
}
close(f)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.