QcMetrics-class {qcmetrics} | R Documentation

## The `"QcMetrics"` class for collections of QC items

### Description

Data structure for storing lists of `QcMetric` items.

### Objects from the Class

Objects can be created using the constructor `QcMetrics(...)`, where slots are assigned individually. See example below.

In a standardised quality control pipeline, the `QcMetrics` and `QcMetric` object are not generated manually. Their creation is delegated to a wrapper function that reads a specific type of files, parses the data, produces the individual `QcMetric` instances and, eventually, the `QcMetric` object. See the package vignette for details and examples.

### Slots

`metadata`:

  Object of class `QcMetadata` storing the metadata of the `object`. This list would typically contain the input file the data was read from, the date the object was generated, ... or fully fledged minimum information descriptions (see `MIAxE`), when available.

`qcdata`:

  Object of class `"list"` storing all the individual `QcMetric` instances.

### Methods

[

  `signature(x = "QcMetrics")`: subsets `x` as a new `QcMetrics` instance.

[[

  `signature(x = "QcMetrics")`: extracts a single `QcMetric` instance.

length

  `signature(x = "QcMetrics")`: returns the number of `QcMetric` instances populate `x`.

metadata

  `signature(x = "QcMetrics")`: return the `object`'s metadata list. Also available as `mdata`.

metadata<-

  `signature(x = "QcMetrics", value = "list")`: sets the objects metadata. Also available as `mdata`.

metadata<-

  `signature(x = "QcMetric", value = "QcMetadata")`: sets the objects metadata. Also available as `mdata`.

name

  `signature(object = "QcMetrics")`: returns a `character` vector of length `length(object)` with the names of the `QcMetric` instances.

qcdata

  `signature(object = "QcMetrics", x = "missing")`: returns a list of all `QcMetric` instances.

qcdata<-

  `signature(object = "QcMetrics", value = "list")`: sets the `qcdata` of object.

show

  `signature(object = "QcMetrics")`: prints a short textual description of `object`.

status

  `signature(object = "QcMetrics")`: returns a vector of quality statuses (`logicals`).

status<-

  `signature(object = "QcMetrics", value = "logical")`: sets the quality statuses. Length of `value` and `object` must be identical.

as

  `signature(object = "QcMetrics", "data.frame")`: coerces `object` as a `length(object)` by 2 data frame with the respective `QcMetric` instances names and statuses.

qcReport

  `signature(object = "QcMetrics")`: ...

### Author(s)

Laurent Gatto <lg390@cam.ac.uk>

### See Also

The `QcMetric` class for individual QC items.

### Examples

    example(QcMetric)
    show(qc)

    qc2 <- QcMetric(name = "My other metric", status = TRUE)
    qcdata(qc2, "x") <- rnorm(100)
    qcdata(qc2, "k") <- rep(LETTERS[1:2], 50)

    plot(qc2) <- function(object, ...) {
        require("lattice")
        d <- data.frame(x = qcdata(object, "x"),
                        k = qcdata(object, "k"))
        bwplot(x ~ k, data = d)
    }

    qcm <- QcMetrics(qcdata = list(qc, qc2))
    qcm

    qcm[1] ## a QcMetrics instance
    qcm[[1]] ## a single QcMetric

    metadata(qcm)
    metadata(qcm) <- QcMetadata(list(name = "Prof. Who",
                                     lab = "Cabin University"))
    ## or, shorter but equivalent
    metadata(qcm) <- list(name = "Prof. Who",
                          lab = "Cabin University")
    metadata(qcm) ## or mdata(qcm)
    ## update metadata
    metadata(qcm) <- list(lab = "Big lab", ## updated
                          uni = "Cabin University") ## added
    mdata(qcm)

[Package qcmetrics version 1.24.0 Index]