read_bim {genio} | R Documentation |
Read Plink *.bim files
Description
This function reads a standard Plink *.bim file into a tibble with named columns.
It uses readr::read_table()
to do it efficiently.
Usage
read_bim(file, verbose = TRUE)
Arguments
file |
Input file (whatever is accepted by |
verbose |
If |
Value
A tibble with columns: chr
, id
, posg
, pos
, alt
, ref
.
See Also
read_plink()
for reading a set of BED/BIM/FAM files.
Plink BIM format references: https://www.cog-genomics.org/plink/1.9/formats#bim https://www.cog-genomics.org/plink/2.0/formats#bim
Examples
# to read "data.bim", run like this:
# bim <- read_bim("data")
# this also works
# bim <- read_bim("data.bim")
# The following example is more awkward
# because package sample data has to be specified in this weird way:
# read an existing Plink *.bim file
file <- system.file("extdata", 'sample.bim', package = "genio", mustWork = TRUE)
bim <- read_bim(file)
bim
# can specify without extension
file <- sub('\\.bim$', '', file) # remove extension from this path on purpose
file # verify .bim is missing
bim <- read_bim(file) # loads too!
bim