submatrix: Extract a submatrix for a given taxomic group and/or sampling...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/submatrix.R

Description

Given a baseline dataset, this function extracts a sub-dataset for a given taxomic group and/or sampling scheme, defined either by a sampling interval (periodicity) or by a window size (consecutive sampling days each time) and a gap size (gaps between sampling windows).

Usage

1
2
3
4
submatrix(dataset, sampl.columns, sampl.interval = NULL, 
window.size = NULL, gap.size = NULL, start.column = 1, 
group.column = NULL, group.names = NULL, remove.zeros = TRUE, 
keep.nonsampl.columns = TRUE)

Arguments

dataset

name of the matrix or dataframe to analyze

sampl.columns

index numbers of the (consecutive) columns containing the baseline (daily) sampling data, e.g. 3:180

sampl.interval

interval at which to extract sampling data, e.g. 5 (to take one every five samples)

window.size

instead of sampl.interval (for one sampling every so many time units), size (in sampling time units, e.g. days) of each sampling window (e.g. 3 for 3 consecutive days sampling each time); must be complemented with gap.size, for the gap between sampling windows.

gap.size

size (in sampling time units, e.g. days) of the gaps between sampling windows – e.g. 1 for 1 gap (non-sampled) day between sampling windows.

start.column

column of sampl.columns where to actually start the sampling (e.g. with a gap size of 1 between sampling windows, the start column can be either 1 or 2)

group.column

name or index number of the column containing the taxa or groups to analyse, e.g. 3 or "Family"

group.names

name(s) of the group(a) to extract, e.g. c("Mustelidae", "Procyonidae"); if NULL (the default), all groups in group.names are extracted

remove.zeros

logical indicating whether to remove rows where all extracted days have zero observations

keep.nonsampl.columns

logical indicating whether to keep the non-sampling columns in the extracted result

Value

This function returns a subset of dataset containing the taxonomic groups and sampling columns resulting from the given sampling scheme.

Author(s)

A. Marcia Barbosa, J. Tiago Marques

See Also

sequential.submatrix, subset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(roadkills)

submat1 <- submatrix(dataset = roadkills, sampl.columns = 4:ncol(roadkills),
sampl.interval = 3, start.column = 1, group.column = "taxon", group.names = NULL)

head(submat1)

submat2 <- submatrix(dataset = roadkills, sampl.columns = 4:ncol(roadkills),
window.size = 5, gap.size = 2, start.column = 1, group.column = "taxon",
group.names = NULL)

head(submat2)

AMBarbosa/DeadCanMove documentation built on Nov. 3, 2021, 10:03 a.m.