PolyGenius
Contents

artifacts

Access an object's plot-support artifacts

Reads and writes the artifact tables an analysis emitted alongside its results. A bare value carries them as an attribute; a PolyGeniusAssociation or PolyGeniusEvaluation carries them in $artifacts.

  • artifacts(x) returns every artifact, artifacts(x, field) one of them.
  • artifacts(x) <- value replaces them all, artifacts(x, field) <- value sets or removes one, creating an empty set first when none exists.

Usage

S3 method for class 'PolyGeniusAssociation'

artifacts(x, field = NULL, ...)

artifacts(x, field = NULL, ...)

artifacts(x, field = NULL) <- value

Default S3 method:

artifacts(x, field = NULL, ...)

Default S3 method:

artifacts(x, field = NULL) <- value

S3 method for class 'PolyGeniusResult'

artifacts(x, field = NULL, ...)

S3 method for class 'PolyGeniusResult'

artifacts(x, field = NULL) <- value

Arguments

ArgumentDescription
xAn R object able to carry attributes, or a PolyGeniusResult.
fieldArtifact name, default NULL. A single non-empty string; NULL addresses every artifact.
...Unused. Present for S3 method compatibility.
valueA named list of artifacts, or NULL to drop them. With a field, the value stored as that artifact, or NULL to remove it. Stored verbatim: on a [PolyGeniusAssociation](/reference/polygeniusassociation/) the value is not re-compacted against $fits, so writing back a table the getter joined leaves the identity columns duplicated in the store, and an identity column present there shadows $fits on the next read.

Value

  • Getter: a named list of every artifact, the one named by field, or NULL when the set or the entry is absent. On a PolyGeniusAssociation each tabular artifact has the $fits columns joined on and moved to the front; a non-tabular one is returned unchanged.
  • Setter: x with the artifacts updated.

Examples

assoc <- PolyGeniusAssociation(
  results   = data.frame(.fit = 1L, outcome = "ldl", estimate = 0.2),
  fits      = data.frame(.fit = 1L, fit.id = "f1", outcome = "ldl"),
  artifacts = list(grid = data.frame(.fit = 1L, x = 1:3, fitted = c(0.1, 0.2, 0.3)))
)
artifacts(assoc, "grid")

evaluation <- PolyGeniusEvaluation(
  results   = data.frame(model = "m1", metric = "auc", value = 0.7),
  artifacts = list(roc = data.frame(fpr = c(0, 1), tpr = c(0, 1)))
)
artifacts(evaluation, "roc")

See Also

Aliases: artifacts, artifacts.PolyGeniusAssociation, artifacts<-, artifacts.default, artifacts<-.default, artifacts.PolyGeniusResult, artifacts<-.PolyGeniusResult