Convert a data.frame between wide and long formats.
formatWide(dfin, sep = ".", obsToY, type, ...)
formatLong(dfin, species = NULL, type, ...)
A data.frame
A data.frame to be reformatted.
A seperator of column names in wide format.
Optional matrix specifying relationship between covariate column structure and response matrix structure.
Type of unmarkedFrame to create?
Character name of species response column
Further arguments to the unmarkedFrame* constructor functions
Note that not all possible unmarkedFrame
* classes have been tested with these
functions. Multinomial data sets (e.g., removal, double-observer, capture-recapture)
are almost certainly easier to enter directly to the constructor function and are not
supported by formatLong
or formatWide
.
In order for these functions to work, the columns of dfin
need to be in the
correct order. formatLong
requires that the columns are in the
following scheme:
site name or number.
date or observation number.
response variable (detections, counts, etc).
The remaining columns are observation-level covariates.
formatWide
requires particular names for the columns.
The column order for formatWide
is
(optional) site name, named “site”.
response, named “y.1”, “y.2”, ..., “y.J”.
columns of site-level covariates, each with a relevant name per column.
groups of columns of observation-level covariates, each group having the name form “someObsCov.1”, “someObsCov.2”, ..., “someObsCov.J”.
csvToUMF