Learn R Programming

nprcgenekeepr (version 3.0.0)

readSnapshotHistory: Read a colony snapshot-history table from a file

Description

Reads a user-maintained longitudinal colony snapshot history (issue #167) from a file into a data frame for checkSnapshotHistory. The history is the single CSV a colony manager keeps between analyses: one row per recorded snapshot in the 27-column version-1 schema (see checkSnapshotHistory for the column groups). Excel (.xls/.xlsx) and delimited text (.csv/.txt) files are both accepted, mirroring readKinshipOverrides. Excel files are read with every column as text and then the numeric columns (e.g. schemaVersion) are converted to numbers, so an Excel file and a delimited text file of the same table give the same result. A numeric column that holds a value that is not a number is left as text and checkSnapshotHistory stops, naming it.

Usage

readSnapshotHistory(fileName, sep = ",")

Value

A data frame of the rows read from fileName. Validate it with checkSnapshotHistory before use.

Arguments

fileName

character vector of length one; path to the snapshot history file (typically the temporary datapath from a Shiny file upload, or a path the user's own scripts maintain).

sep

column separator for delimited text files (default ","). Ignored for Excel files.

Details

This reader does not validate structure or domain — that is checkSnapshotHistory's job, matching the reader/validator sibling-pair convention.

Examples

Run this code
history <- readSnapshotHistory(system.file("extdata", "examples",
  "example_snapshot_history.csv",
  package = "nprcgenekeepr"
))
history <- checkSnapshotHistory(history)

Run the code above in your browser using DataLab