Skip to contents

Reads the focal animal ids from the first column of a CSV or Excel file and pulls the pedigree of their relatives from LabKey.

Usage

getFocalAnimalPed(fileName, sep = ",")

Arguments

fileName

character vector of temporary file path of a CSV or Excel file whose first column lists the focal animal ids.

sep

column separator in CSV file

Value

A data.frame (not a file) with columns id, sex, birth, death, departure, dam and sire; the dates are character strings formatted as %Y-%m-%d. When the LabKey connection fails, an nprcgenekeeprErr list with failedDatabaseConnection set is returned instead.

Examples

library(nprcgenekeepr)
## A successful call needs a LabKey connection and a file of focal ids.
## This file does not exist, so the example shows the error handler.
source <- " generated by getFocalAnimalPed: "
tryCatch(getFocalAnimalPed(fileName = "breeding file.csv"),
  warning = function(wCond) {
    cat(paste0("Warning", source, wCond),
      name = "nprcgenekeepr"
    )
    return(NULL)
  },
  error = function(eCond) {
    cat(paste0("Error", source, eCond),
      name = "nprcgenekeepr"
    )
    return(NULL)
  }
)
#> Error generated by getFocalAnimalPed: Error in file(file, "rt"): cannot open the connection
#>  nprcgenekeepr
#> NULL