Getters and setters to retrieve or set parts of an object.

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 as x with the new values assigned.

  • get_*() returns the part of x.

  • has_*() returns a logical scalar.

Details

get_samples(x) and get_samples(x) <- value

Get or set the sample names of x.

get_groups(x) and set_groups(x) <- value

Get or set the groups of x.

get_dates(x) and set_dates(x) <- value

Get or set the dates of x.

get_terminus(x) and set_terminus(x) <- value

Get or set the chronology of x. value must be a list with components tpq (TPQ - terminus post quem) and taq (TAQ - terminus ante quem).

get_tpq(x) and set_tpq(x) <- value, get_taq(x) and set_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).

See also

Other mutators: subset(), summary()

Author

N. Frerebeau

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  1338 1473
#> row2  1370 1490
#> row3  1311 1473
#> row4  1312 1471
#> row5  1348 1488
#> row6  1306 1486
#> row7  1388 1470
#> row8  1391 1491
#> row9  1348 1486
#> row10 1399 1461

## Collection of features
as_features(Z)
#>       V1 V2 V3 V4 V5 samples group dates  tpq  taq
#> row1   6  7  5  8  4       a     A    NA 1338 1473
#> row2   2  2  9  1  7       a     A    NA 1370 1490
#> row3   7  6 10  5  9       b     A    NA 1311 1473
#> row4   2  6  7  7  3       b     A    NA 1312 1471
#> row5   5  7  4  4  6       c     A    NA 1348 1488
#> row6   5  7  0  2 10       c     B    NA 1306 1486
#> row7   7  3  1  9  3       d     B    NA 1388 1470
#> row8   2  8  0 10  9       d     B    NA 1391 1491
#> row9   4  5  2  8  5       e     B    NA 1348 1486
#> row10  3  1  5  6  0       e     B    NA 1399 1461

## Summarize data
summary(Z)
#> <AbundanceSummary: 10 x 5>
#> A ------------------------------------------------------------------------------
#> * Observations: 5
#> * Variables: 5
#> * Replicated measurements: TRUE
#> * Chronology: 1311 - 1490 (year CE)
#> B ------------------------------------------------------------------------------
#> * Observations: 5
#> * Variables: 5
#> * Replicated measurements: TRUE
#> * Chronology: 1306 - 1491 (year CE)
#> --------------------------------------------------------------------------------