read.FMDB {fishWiDNR}R Documentation

Read CSV of WiDNR Fish Management Data.

Description

Reads a CSV of WiDNR Fish Management Data, sets variable classes, and optionally adds some variables and expands fish counts.

Usage

read.FMDB(file, addSpecies = TRUE, addMonth = TRUE, expandCounts = FALSE,
  whichLengths = c("in", "mm"), lprec = 0.1, na.strings = c("-", "NA",
  ""), verbose = TRUE)

Arguments

file

The name of the external CSV file from the WiDNR Fisheries Management Database.

addSpecies

A logical that indicates whether a new variable of species names where only the first word is capitalized should be added to the returned data.frame.

addMonth

A logical that indicates whether a new variable of month of capture should be added to the returned data.frame.

expandCounts

A logical that indicates whether counts of fish of the same length should be expanded to be individual fish in the returned data.frame or not. See expandCounts in FSA.

whichLengths

A character string that indicates whether the expanded lengths, when expandCounts=TRUE, use the English (inches; whichLengths="in") or metric (mm; whichLengths="mm") units variable.

lprec

A single numeric that controls the precision to which the random lengths are recorded. See details in expandCounts in FSA.

na.strings

A vector of character strings that indicate what type of characters should be considered missing when reading the CSV file. Likely does not need to be changed.

verbose

A logical that indicates whether progress messages should be printed or not.

...

Not yet implemented.

Details

This function is used to read a CSV created directlys from the WiDNR Fish Management Database and appropriately set the class type (e.g., integer, factor, etc.) for the variables. Optionally, the user may add the month the fish was collected and change the species names so that only the first letters are capitalized (so as to work more easily with other functions). Furthermore, the user may optionally choose to expand the counts of fish of the same lengths (often times no length was recorded, fish were just counted).

Value

A data.frame.

Author(s)

Derek H. Ogle, dogle@northland.edu

See Also

setFMDBClasses; expandCounts in FSA.

Examples

## Get external file (as part of the package)
ftmp <- system.file("extdata", "FMDB_ex.csv",package="fishWiDNR")

## Read file without expanding counts
df1 <- read.FMDB(ftmp)
str(df1)

## Read file with expanding counts
df2 <- read.FMDB(ftmp,expandCounts=TRUE)
str(df2)


[Package fishWiDNR version 0.0.6 Index]