Skip to contents

Reshapes one metric of [dataset_traits()] into the shape an ordination or a distance function expects: one row per sample, one column per GIFT or genome the metric was reported for.

Usage

dataset_matrix(traits, metric_id, frame = NULL, fill = NA)

Arguments

traits

A `gifter_dataset_traits` from [dataset_traits()].

metric_id

One metric identifier.

frame

Reference frame label. Required whenever the metric was reported for more than one, because stacking a metric across frames puts columns with different denominators side by side.

fill

Value for a cell the metric was not reported for. `NA` by default.

Value

A numeric matrix with samples as rows, carrying `metric_id`, `reference_frame` and `database_version` attributes.

Absent cells are not zeros

A metric is reported only where it exists. `provider_count` has no row for a GIFT no genome in a sample supports, and whether that is a true zero or a GIFT nothing in that sample could assess is exactly the distinction the assessability layer exists to keep. The cell is therefore `NA` by default and gifter does not guess. `fill = 0` is available for the caller who knows what the absence means for their metric — and it is then the caller's claim.