Revision 680619b96c0dc2f5a1cb12e0a06005d76f857be5 authored by pat-s on 06 December 2019, 11:37:28 UTC, committed by pat-s on 06 December 2019, 11:37:28 UTC
Build URL: https://circleci.com/gh/mlr-org/mlr/992 Commit:
1 parent 88a0774
Measure_properties.R
#' @title Query properties of measures.
#'
#' @description
#' Properties can be accessed with `getMeasureProperties(measure)`, which returns a
#' character vector.
#'
#' The measure properties are defined in [Measure].
#' @template arg_measure
#' @param props ([character])\cr
#' Vector of properties to query.
#' @return `getMeasureProperties` returns a character vector with measure properties.
#' `hasMeasureProperties` returns a logical vector of the same length as `props`.
#' @name MeasureProperties
#' @rdname MeasureProperties
#' @aliases getMeasureProperties hasMeasureProperties
NULL
#' @rdname MeasureProperties
#' @export
getMeasureProperties = function(measure) {
assertClass(measure, classes = "Measure")
measure$properties
}
#' @rdname MeasureProperties
#' @export
hasMeasureProperties = function(measure, props) {
assertClass(measure, classes = "Measure")
assertSubset(props, listMeasureProperties())
props %in% getMeasureProperties(measure)
}
#' @title List the supported measure properties.
#'
#' @description
#' This is useful for determining which measure properties are available.
#'
#' @return ([character]).
#'
#' @export
listMeasureProperties = function() {
mlr$measure.properties
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...