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