diff --git a/R/labels.R b/R/labels.R index c9211b9..2c170a6 100644 --- a/R/labels.R +++ b/R/labels.R @@ -140,7 +140,8 @@ hySpc.testthat::test(.labels) <- function() { #' @examples #' #' labels(flu, "c") <- expression("/"("c", "mg / l")) -`labels<-` <- function(object, which = NULL, ..., value) { +# helper function (similar to .labels for the getter) +.labels_replace <- function(object, which = NULL, ..., value) { assert_hyperSpec(object) validObject(object) @@ -163,6 +164,17 @@ hySpc.testthat::test(.labels) <- function() { object } +# generic replacement function +#' @export +setGeneric("labels<-", function(object, which = NULL, ..., value) { + standardGeneric("labels<-") +}) + +setMethod("labels<-", + signature = signature(object = "hyperSpec"), + .labels_replace +) + # Unit tests -----------------------------------------------------------------