| impute_snps | R Documentation |
Fills NA entries in SNP data by computing column or row means of non-missing values. Intended for 0/1/2-coded diploid genotype matrices.
impute_snps(x, ...)
## S3 method for class 'HDF5Matrix'
impute_snps(
x,
out_group = NULL,
out_dataset = NULL,
by_cols = TRUE,
threads = -1L,
overwrite = FALSE,
...
)
x |
An |
... |
Ignored. |
out_group |
Output group. |
out_dataset |
Output dataset name. |
by_cols |
Logical. Impute by columns ( |
threads |
Integer. Number of threads (-1 = auto). |
overwrite |
Logical. Overwrite existing output. Default |
HDF5Matrix pointing to the imputed dataset.
tmp <- tempfile(fileext = ".h5")
# SNP data: 0/1/2 coded, 3 = missing (not NA)
snps <- matrix(sample(c(0L, 1L, 2L, 3L), 100 * 20,
replace = TRUE,
prob = c(0.3, 0.3, 0.3, 0.1)),
nrow = 100, ncol = 20)
X <- hdf5_create_matrix(tmp, "geno/raw", data = snps)
imp <- impute_snps(X, out_group = "geno", out_dataset = "imputed")
dim(imp)
hdf5_close_all()
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.