snp_getSampleInfos: Get sample information

Description Usage Arguments Value See Also Examples

View source: R/get-save-infos.R

Description

Get information of individuals by matching from an external file.

Usage

1
2
3
4
5
6
7
8
9
snp_getSampleInfos(
  x,
  df.or.files,
  col.family.ID = 1,
  col.sample.ID = 2,
  col.infos = -c(1, 2),
  pair.sep = "-_-",
  ...
)

Arguments

x

A bigSNP.

df.or.files

Either

  • A data.frame,

  • A character vector of file names where to find at the information you want. You should have one column for family IDs and one for sample IDs.

col.family.ID

Index of the column containing the family IDs to match with those of the study. Default is the second one.

col.sample.ID

Index of the column containing the sample IDs to match with those of the study. Default is the first one.

col.infos

Indices of the column containing the information you want. Default is all but the first and the second columns.

pair.sep

Separator used for concatenation family and sample IDs in order to match easier. Default is "-_-".

...

Any additional parameter to pass to bigreadr::fread2(). Particularly, option header = FALSE is sometimes needed.

Value

The requested information as a data.frame.

See Also

list.files

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
test <- snp_attachExtdata()
# Just after reading
rle(test$fam$family.ID)
# Get populations clusters from external files
files <- system.file("extdata", paste0("cluster", 1:3), package = "bigsnpr")
bigreadr::fread2(files[1])
# need header option
bigreadr::fread2(files[1], header = FALSE)
infos <- snp_getSampleInfos(test, files, header = FALSE)
rle(infos[[1]])

bigsnpr documentation built on June 3, 2021, 5:12 p.m.