read_pheno: Read phenotype data

View source: R/read_pheno.R

read_phenoR Documentation

Read phenotype data

Description

Read phenotype data from a CSV file (and, optionally, phenotype covariate data from a separate CSV file). The CSV files may be contained in zip files, separately or together.

Usage

read_pheno(
  file,
  phenocovarfile = NULL,
  sep = ",",
  na.strings = c("-", "NA"),
  comment.char = "#",
  transpose = FALSE,
  quiet = TRUE
)

Arguments

file

Character string with path to the phenotype data file (or a zip file containing both the phenotype and phenotype covariate files).

phenocovarfile

Character string with path to the phenotype covariate file. This can be a separate CSV or zip file; if a zip file, it must contain exactly one CSV file. Alternatively, if the file argument indicates a zip file that contains two files (phenotypes and phenotype covariates), then this phenocovarfile argument must indicate the base name for the phenotype covariate file.

sep

the field separator character

na.strings

a character vector of strings which are to be interpreted as NA values.

comment.char

A character vector of length one containing a single character to denote comments within the CSV files.

transpose

If TRUE, the phenotype data will be transposed. The phenotype covariate information is never transposed.

quiet

If FALSE, print progress messages.

Value

Either a matrix of phenotype data, or a list containing pheno (phenotype matrix) and phenocovar (phenotype covariate matrix).

See Also

read_cross2(), sample data files at https://kbroman.org/qtl2/pages/sampledata.html and https://github.com/rqtl/qtl2data

Examples

## Not run: 
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/main/Gough/gough_pheno.csv")
phe <- read_pheno(file)

phecovfile <- paste0("https://raw.githubusercontent.com/rqtl/",
                     "qtl2data/main/Gough/gough_phenocovar.csv")
phe_list <- read_pheno(file, phecovfile)

## End(Not run)

qtl2 documentation built on April 22, 2023, 1:10 a.m.