Skip to contents

Read an excel-file in the Smoltreg-format and do some basic cleanup before a data.frame is returned. If a vector of dummy_tags is given all tags matching are removed. The species name is standardized to capital first letter and the rest lowercase. Columns smoltstat and genid are uppercased. The column date_time is standarised to POSIXct and missing values are imputed using a "last observation carried forward" algorithm. Missing Any NA in column event are replaced with the UNKNOWN event code. Recaptured fish without species get the species set to the same as the MARKED event for that pit tag.

Usage

read_fish(
  xlsxfile,
  dummy_tags = NULL,
  sheet = "Fiskdata",
  date_formats = c("%Y-%m-%d %H:%M:%S", "%Y-%m-%d", "%m-%d-%Y %H:%M:%S",
    "%m/%d/%y.%H:%M:%S")
)

Arguments

xlsxfile

Name on excel-file following the "Smoltreg"-format

dummy_tags

Vector of character with tags used as dummies that should be removed

sheet

Name of sheet with the fish data. Default = "Fiskdata"

date_formats

Character vector with DateTime formats that should be tried when reading dates

Value

A data frame with fishdata from the smolt trap. Basic cleanup done.