Learn R Programming

bigsnpr (version 1.9.11)

snp_subset: Subset a bigSNP

Description

Subset (copy) of a bigSNP, also stored on disk.

Usage

snp_subset(
  x,
  ind.row = rows_along(x$fam),
  ind.col = rows_along(x$map),
  backingfile = NULL
)

# S3 method for bigSNP subset( x, ind.row = rows_along(x$fam), ind.col = rows_along(x$map), backingfile = NULL, ... )

Value

The path to the RDS file that stores the bigSNP object.

Arguments

x

A bigSNP.

ind.row

Indices of the rows (individuals) to keep. Negative indices can be used to exclude row indices. Default: keep them all.

ind.col

Indices of the columns (SNPs) to keep. Negative indices can be used to exclude column indices. Default: keep them all.

backingfile

Prefix of the two new files created (".bk" and ".rds"). By default, it is automatically determined by appending "_sub" and a number to the prefix of the input bigSNP backing files.

...

Not used.

See Also

bigSNP

Examples

Run this code
str(test <- snp_attachExtdata())

# keep only first 50 samples and SNPs
rdsfile <- snp_subset(test, ind.row = 1:50, ind.col = 1:50)
str(snp_attach(rdsfile))

# remove only first 50 samples and SNPs
rdsfile2 <- snp_subset(test, ind.row = -(1:50), ind.col = -(1:50))
str(snp_attach(rdsfile2))

Run the code above in your browser using DataLab