Learn R Programming

arkhe (version 0.5.0)

mutators: Get or Set Parts of an Object

Description

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

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.

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.

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).

Author

N. Frerebeau

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.

See Also

Other mutators: subset(), summary()

Examples

Run this code
## 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)

## Set/get groups
set_groups(Z) <- rep(c("A", "B"), each = 5)
get_groups(Z)

## 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)

## Collection of features
as_features(Z)

## Summarize data
summary(Z)

Run the code above in your browser using DataLab