R/read_plink2_psam_file.R

Defines functions read_plink2_psam_file

Documented in read_plink2_psam_file

#' Read a `PLINK2` `.psam` file
#' @inheritParams default_params_doc
#' @author Richèl J.C. Bilderbeek
#' @export
 read_plink2_psam_file <- function(
  psam_filename
) {
   testthat::expect_true(file.exists(psam_filename))
   df <- data.table::fread(psam_filename, data.table = FALSE)
   names(df) <- c("FID", names(df)[-1])
   psam_table <- tibble::as_tibble(df)

   psam_table$FID <- as.character(psam_table$FID) # nolint PLINK2 notation
   psam_table$IID <- as.character(psam_table$IID) # nolint PLINK2 notation
   psam_table
}
richelbilderbeek/plinkr documentation built on March 25, 2024, 3:18 p.m.