Getters and setters to retrieve or set parts of an object.
Usage
has_groups(x)
get_groups(x)
set_groups(x) <- value
get_samples(x)
set_samples(x) <- value
has_dates(x)
get_dates(x)
set_dates(x) <- value
has_terminus(x)
get_terminus(x)
set_terminus(x) <- value
get_tpq(x)
set_tpq(x) <- value
get_taq(x)
set_taq(x) <- value
get_totals(x)
set_totals(x) <- value
# S4 method for AbundanceMatrix
has_groups(x)
# S4 method for AbundanceMatrix
get_groups(x)
# S4 method for AbundanceMatrix
get_samples(x)
# S4 method for AbundanceMatrix
has_dates(x)
# S4 method for AbundanceMatrix
get_dates(x)
# S4 method for AbundanceMatrix
has_terminus(x)
# S4 method for AbundanceMatrix
get_terminus(x)
# S4 method for AbundanceMatrix
get_tpq(x)
# S4 method for AbundanceMatrix
get_taq(x)
# S4 method for AbundanceMatrix
get_totals(x)
# S4 method for OccurrenceMatrix
get_totals(x)
# S4 method for AbundanceMatrix
set_groups(x) <- value
# S4 method for AbundanceMatrix
set_samples(x) <- value
# S4 method for AbundanceMatrix,`NULL`
set_dates(x) <- value
# S4 method for AbundanceMatrix,numeric
set_dates(x) <- value
# S4 method for AbundanceMatrix,`NULL`
set_terminus(x) <- value
# S4 method for AbundanceMatrix,list
set_terminus(x) <- value
# S4 method for AbundanceMatrix,`NULL`
set_tpq(x) <- value
# S4 method for AbundanceMatrix,numeric
set_tpq(x) <- value
# S4 method for AbundanceMatrix,`NULL`
set_taq(x) <- value
# S4 method for AbundanceMatrix,numeric
set_taq(x) <- value
# S4 method for AbundanceMatrix
set_totals(x) <- value
Arguments
- x
An object from which to get or set element(s) (typically an
AbundanceMatrix
object).- value
A possible value for the element(s) of
x
.
Value
set_*()
returns an object of the same sort asx
with the new values assigned.get_*()
returns the part ofx
.has_*()
returns alogical
scalar.
Details
get_samples(x)
andget_samples(x) <- value
Get or set the sample names of
x
.get_groups(x)
andset_groups(x) <- value
Get or set the groups of
x
.get_dates(x)
andset_dates(x) <- value
Get or set the dates of
x
.get_terminus(x)
andset_terminus(x) <- value
Get or set the chronology of
x
.value
must be alist
with componentstpq
(TPQ - terminus post quem) andtaq
(TAQ - terminus ante quem).get_tpq(x)
andset_tpq(x) <- value
,get_taq(x)
andset_taq(x) <- value
Get or set the TPQ/TAQ of
x
.
Chronology
The way chronological information is handled is somewhat opinionated.
Sub-annual precision is overkill/meaningless in most situations: dates are
assumed to be expressed in years CE and are stored as integers (values are
coerced with as.integer()
and hence truncated towards zero).
Examples
## Create a data.frame
X <- matrix(data = sample(0:10, 50, TRUE), nrow = 10, ncol = 5)
Y <- as.data.frame(X)
## Coerce to a count matrix
Z <- as_count(Y)
## Set/get groups
set_samples(Z) <- rep(c("a", "b", "c", "d", "e"), each = 2)
get_samples(Z)
#> [1] "a" "a" "b" "b" "c" "c" "d" "d" "e" "e"
## Set/get groups
set_groups(Z) <- rep(c("A", "B"), each = 5)
get_groups(Z)
#> [1] "A" "A" "A" "A" "A" "B" "B" "B" "B" "B"
## Get/get TPQ/TAQ
chrono <- list(
tpq = sample(1301:1400, 10, replace = TRUE),
taq = sample(1451:1500, 10, replace = TRUE)
)
set_terminus(Z) <- chrono
get_terminus(Z)
#> tpq taq
#> row1 1398 1472
#> row2 1346 1494
#> row3 1397 1482
#> row4 1301 1498
#> row5 1333 1490
#> row6 1324 1453
#> row7 1331 1492
#> row8 1343 1483
#> row9 1370 1473
#> row10 1392 1460
## Collection of features
as_features(Z)
#> V1 V2 V3 V4 V5 samples group dates tpq taq
#> row1 1 7 7 7 4 a A NA 1398 1472
#> row2 7 5 6 7 5 a A NA 1346 1494
#> row3 9 4 9 8 6 b A NA 1397 1482
#> row4 10 6 7 6 8 b A NA 1301 1498
#> row5 8 9 9 9 1 c A NA 1333 1490
#> row6 10 10 6 0 6 c B NA 1324 1453
#> row7 4 5 9 6 7 d B NA 1331 1492
#> row8 3 9 7 7 2 d B NA 1343 1483
#> row9 8 1 10 4 8 e B NA 1370 1473
#> row10 9 10 2 10 6 e B NA 1392 1460
## Summarize data
summary(Z)
#> <AbundanceSummary: 10 x 5>
#> A ------------------------------------------------------------------------------
#> * Observations: 5
#> * Variables: 5
#> * Replicated measurements: TRUE
#> * Chronology: 1301 - 1498 (year CE)
#> B ------------------------------------------------------------------------------
#> * Observations: 5
#> * Variables: 5
#> * Replicated measurements: TRUE
#> * Chronology: 1324 - 1492 (year CE)
#> --------------------------------------------------------------------------------