csvToUMF: Convert .CSV File to an unmarkedFrame

Description Usage Arguments Details Value Author(s) Examples

View source: R/utils.R

Description

This function converts an appropriatedly formated comma-separated values file (.csv) to a format usable by unmarked's fitting functions (see Details).

Usage

1
csvToUMF(filename, long=FALSE, type, species, ...)

Arguments

filename

string describing filename of file to read in

long

FALSE if file is in long format or TRUE if file is in long format (see Details)

species

if data is in long format with multiple species, then this can specify a particular species to extract if there is a column named "species".

type

specific type of unmarkedFrame.

...

further arguments to be passed to the unmarkedFrame constructor.

Details

This function provides a quick way to take a .csv file with headers named as described below and provides the data required and returns of data in the format required by the model-fitting functions in unmarked. The .csv file can be in one of 2 formats: long or wide. See the first 2 lines of the examples for what these formats look like.

The .csv file is formatted as follows:

Value

an unmarkedFrame object

Author(s)

Ian Fiske ianfiske@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# examine a correctly formatted long .csv
head(read.csv(system.file("csv","frog2001pcru.csv", package="unmarked")))

# examine a correctly formatted wide .csv
head(read.csv(system.file("csv","widewt.csv", package="unmarked")))

# convert them!
dat1 <- csvToUMF(system.file("csv","frog2001pcru.csv", package="unmarked"),
                 long = TRUE, type = "unmarkedFrameOccu")
dat2 <- csvToUMF(system.file("csv","frog2001pfer.csv", package="unmarked"),
                 long = TRUE, type = "unmarkedFrameOccu")
dat3 <- csvToUMF(system.file("csv","widewt.csv", package="unmarked"),
                 long = FALSE, type = "unmarkedFrameOccu")

unmarked documentation built on May 27, 2021, 5:07 p.m.