diff --git a/NEWS.md b/NEWS.md index 45768a4..41f4700 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # eaf 2.3 +* `eafplot()` now returns the attainment surfaces computed invisibly. # eaf 2.2 diff --git a/R/eaf.R b/R/eaf.R index 3b829fc..aded6a8 100644 --- a/R/eaf.R +++ b/R/eaf.R @@ -603,7 +603,7 @@ eafplot <- function(x, ...) UseMethod("eafplot") #' #' @param ... Other graphical parameters to [plot.default()]. #' -#' @return No value is returned. +#' @return Return (invisibly) the attainment surfaces computed. #' #' @seealso [read_datasets()] [eafdiffplot()] #' @@ -623,7 +623,9 @@ eafplot <- function(x, ...) UseMethod("eafplot") #' A1 <- read_datasets(file.path(extdata_path, "ALG_1_dat.xz")) #' A2 <- read_datasets(file.path(extdata_path, "ALG_2_dat.xz")) #' eafplot(A1, percentiles = 50, sci.notation = TRUE) -#' eafplot(list(A1 = A1, A2 = A2), percentiles = 50) +#' # The attainment surfaces are returned invisibly. +#' attsurfs <- eafplot(list(A1 = A1, A2 = A2), percentiles = 50) +#' str(attsurfs) #' #' ## Save as a PDF file. #' # dev.copy2pdf(file = "eaf.pdf", onefile = TRUE, width = 5, height = 4) @@ -883,7 +885,7 @@ eafplot.default <- } box() - invisible() + invisible(attsurfs) } prettySciNotation <- function(x, digits = 1L) diff --git a/man/eafplot.Rd b/man/eafplot.Rd index a220c38..28a489f 100644 --- a/man/eafplot.Rd +++ b/man/eafplot.Rd @@ -108,7 +108,7 @@ present the plot is conditional to the instances.} \item{subset}{(\code{integer()} | \code{NULL})\cr A vector indicating which rows of the data should be used. If left to default \code{NULL} all data in the data frame are used.} } \value{ -No value is returned. +Return (invisibly) the attainment surfaces computed. } \description{ Computes and plots the Empirical Attainment Function, either as @@ -149,7 +149,9 @@ extdata_path <- system.file(package = "eaf", "extdata") A1 <- read_datasets(file.path(extdata_path, "ALG_1_dat.xz")) A2 <- read_datasets(file.path(extdata_path, "ALG_2_dat.xz")) eafplot(A1, percentiles = 50, sci.notation = TRUE) -eafplot(list(A1 = A1, A2 = A2), percentiles = 50) +# The attainment surfaces are returned invisibly. +attsurfs <- eafplot(list(A1 = A1, A2 = A2), percentiles = 50) +str(attsurfs) ## Save as a PDF file. # dev.copy2pdf(file = "eaf.pdf", onefile = TRUE, width = 5, height = 4)