From b053348bcc62e6225e38d0a07478e30fb29fdb5f Mon Sep 17 00:00:00 2001 From: MLopez-Ibanez <2620021+MLopez-Ibanez@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:41:48 +0000 Subject: [PATCH] * Replace dots in function names with underscore () to silence CRAN Note. --- NEWS.md | 2 + R/eaf.R | 52 ++++++++--------- R/eafplot.R | 120 +++++++++++++++++++------------------- R/nondominated.R | 2 +- R/vorob.R | 30 +++++----- man/attsurf2df.Rd | 2 +- tests/testthat/test-eaf.R | 6 +- 7 files changed, 108 insertions(+), 106 deletions(-) diff --git a/NEWS.md b/NEWS.md index 905eed3..551d5c1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ * Silence some warnings with GCC 12. + * Replace dots in function names with underscore (`_`) to silence CRAN Note. + # eaf 2.4 * If the installation cannot find the Gnu Scientific Library, it gives hints on diff --git a/R/eaf.R b/R/eaf.R index bccde98..c3439e3 100644 --- a/R/eaf.R +++ b/R/eaf.R @@ -48,7 +48,7 @@ ################################################################################ #dyn.load("../src/eaf.so") -check.eaf.data <- function(x) +check_eaf_data <- function(x) { name <- deparse(substitute(x)) if (length(dim(x)) != 2L) @@ -66,9 +66,9 @@ check.eaf.data <- function(x) return(x) } -compute.eaf <- function(data, percentiles = NULL) +compute_eaf <- function(data, percentiles = NULL) { - data <- check.eaf.data(data) + data <- check_eaf_data(data) setcol <- ncol(data) nobjs <- setcol - 1L # The C code expects points within a set to be contiguous. @@ -90,9 +90,9 @@ compute.eaf <- function(data, percentiles = NULL) as.numeric(percentiles))) } -compute.eaf.as.list <- function(data, percentiles = NULL) +compute_eaf_as_list <- function(data, percentiles = NULL) { - eaf <- compute.eaf (data, percentiles = percentiles) + eaf <- compute_eaf (data, percentiles = percentiles) setcol <- ncol(eaf) nobjs <- setcol - 1L eaf_sets <- eaf[, setcol] @@ -103,7 +103,7 @@ compute.eaf.as.list <- function(data, percentiles = NULL) labels = uniq_eaf_sets))) } -compute.eafdiff.helper <- function(data, intervals) +compute_eafdiff_helper <- function(data, intervals) { # Last column is the set number. setcol <- ncol(data) @@ -201,12 +201,12 @@ eafdiff <- function(x, y, intervals = NULL, maximise = c(FALSE, FALSE), } data <- rbind_datasets(x, y) - data <- check.eaf.data(data) + data <- check_eaf_data(data) # FIXME: Is it faster to subset or to multiply the third column by 1? - data[,1:2] <- matrix.maximise(data[,1:2, drop=FALSE], maximise = maximise) + data[,1:2] <- matrix_maximise(data[,1:2, drop=FALSE], maximise = maximise) - DIFF <- if (rectangles) compute.eafdiff.rectangles(data, intervals = intervals) - else compute.eafdiff.helper(data, intervals = intervals) + DIFF <- if (rectangles) compute_eafdiff_rectangles(data, intervals = intervals) + else compute_eafdiff_helper(data, intervals = intervals) # FIXME: We should remove duplicated rows in C code. # FIXME: Check that we do not generate duplicated nor overlapping rectangles @@ -215,9 +215,9 @@ eafdiff <- function(x, y, intervals = NULL, maximise = c(FALSE, FALSE), return(DIFF) } -compute.eafdiff <- function(data, intervals) +compute_eafdiff <- function(data, intervals) { - DIFF <- compute.eafdiff.helper(data, intervals) + DIFF <- compute_eafdiff_helper(data, intervals) #print(DIFF) # FIXME: Do this computation in C code. See compute_eafdiff_area_C setcol <- ncol(data) @@ -230,7 +230,7 @@ compute.eafdiff <- function(data, intervals) # FIXME: The default intervals should be nsets / 2 -compute.eafdiff.rectangles <- function(data, intervals = 1L) +compute_eafdiff_rectangles <- function(data, intervals = 1L) { # Last column is the set number. nobjs <- ncol(data) - 1L @@ -248,7 +248,7 @@ compute.eafdiff.rectangles <- function(data, intervals = 1L) } # FIXME: The default intervals should be nsets / 2 -compute.eafdiff.polygon <- function(data, intervals = 1L) +compute_eafdiff_polygon <- function(data, intervals = 1L) { # Last column is the set number. nobjs <- ncol(data) - 1L @@ -272,7 +272,7 @@ compute.eafdiff.polygon <- function(data, intervals = 1L) } -rm.inf <- function(x, xmax) +rm_inf <- function(x, xmax) { x[is.infinite(x)] <- xmax return(x) @@ -280,7 +280,7 @@ rm.inf <- function(x, xmax) # FIXME: Accept ... -max.finite <- function (x) +max_finite <- function (x) { x <- as.vector(x) x <- x[is.finite(x)] @@ -289,7 +289,7 @@ max.finite <- function (x) } # FIXME: Accept ... -min.finite <- function (x) +min_finite <- function (x) { x <- as.vector(x) x <- x[is.finite(x)] @@ -298,7 +298,7 @@ min.finite <- function (x) } # FIXME: Accept ... -range.finite <- function(x) +range_finite <- function(x) { x <- as.vector(x) x <- x[is.finite(x)] @@ -306,7 +306,7 @@ range.finite <- function(x) return(NULL) } -matrix.maximise <- function(z, maximise) +matrix_maximise <- function(z, maximise) { stopifnot(ncol(z) == length(maximise)) if (is.data.frame(z)) { @@ -341,7 +341,7 @@ rbind_datasets <- function(x,y) ## polygon. ## Example: given ((1,2), (2,1)), it returns ((1,2), (2,2), (2,1)). ## Input should be already in the correct order. -points.steps <- function(x) +points_steps <- function(x) { n <- nrow(x) if (n == 1L) return(x) @@ -419,12 +419,12 @@ eafs <- function (points, sets, groups = NULL, percentiles = NULL) points <- cbind(points, sets) if (is.null(groups)) { - attsurfs <- compute.eaf (points, percentiles) + attsurfs <- compute_eaf (points, percentiles) } else { attsurfs <- data.frame() groups <- factor(groups) for (g in levels(groups)) { - tmp <- compute.eaf(points[groups == g,], percentiles) + tmp <- compute_eaf(points[groups == g,], percentiles) attsurfs <- rbind(attsurfs, data.frame(tmp, groups = g)) } } @@ -433,7 +433,7 @@ eafs <- function (points, sets, groups = NULL, percentiles = NULL) # Get correct xlim or ylim when maximising / minimising. -get.xylim <- function(lim, maximise, data) +get_xylim <- function(lim, maximise, data) { # FIXME: This seems too complicated. if (!is.null(lim) && maximise) lim <- -lim @@ -442,7 +442,7 @@ get.xylim <- function(lim, maximise, data) lim } -get.extremes <- function(xlim, ylim, maximise, log) +get_extremes <- function(xlim, ylim, maximise, log) { if (length(log) && log != "") log <- strsplit(log, NULL)[[1L]] @@ -461,7 +461,7 @@ get.extremes <- function(xlim, ylim, maximise, log) c(extreme1, extreme2) } -add.extremes <- function(x, extremes, maximise) +add_extremes <- function(x, extremes, maximise) { best1 <- if (maximise[1]) max else min best2 <- if (maximise[2]) max else min @@ -474,7 +474,7 @@ add.extremes <- function(x, extremes, maximise) #' #' @param x (`list()`) List of data.frames or matrices. The names of the list #' give the percentiles of the attainment surfaces. This is the format -#' returned by [eafplot()] (and the internal function `compute.eaf.as.list`). +#' returned by [eafplot()] (and the internal function `compute_eaf_as_list`). #' #' @return A data.frame with as many columns as objectives and an additional column `percentiles`. #' diff --git a/R/eafplot.R b/R/eafplot.R index d469cf3..219ed3f 100644 --- a/R/eafplot.R +++ b/R/eafplot.R @@ -181,16 +181,16 @@ eafplot.default <- # efficient, one large matrix or separate points and sets, then be # consistent everywhere. if (!is.null(sets)) x <- cbind(x, sets) - x <- check.eaf.data(x) + x <- check_eaf_data(x) sets <- x[, 3L] x <- as.matrix(x[,1:2, drop=FALSE]) - x <- matrix.maximise(x, maximise) + x <- matrix_maximise(x, maximise) # Transform EAF matrix into attsurfs list. if (is.null(groups)) { - attsurfs <- compute.eaf.as.list(cbind(x, sets), percentiles) + attsurfs <- compute_eaf_as_list(cbind(x, sets), percentiles) } else { - # FIXME: Is this equivalent to compute.eaf.as.list for each g? + # FIXME: Is this equivalent to compute_eaf_as_list for each g? EAF <- eafs(x, sets, groups, percentiles) attsurfs <- list() groups <- factor(EAF$groups) @@ -202,13 +202,13 @@ eafplot.default <- } } # FIXME: rm(EAF) to save memory ? - attsurfs <- lapply(attsurfs, matrix.maximise, maximise = maximise) + attsurfs <- lapply(attsurfs, matrix_maximise, maximise = maximise) } # FIXME: We should take the range from the attsurfs to not make x mandatory. - xlim <- get.xylim(xlim, maximise[1], data = x[,1]) - ylim <- get.xylim(ylim, maximise[2], data = x[,2]) - extreme <- get.extremes(xlim, ylim, maximise, log) + xlim <- get_xylim(xlim, maximise[1], data = x[,1]) + ylim <- get_xylim(ylim, maximise[2], data = x[,2]) + extreme <- get_extremes(xlim, ylim, maximise, log) # FIXME: Find a better way to handle different x-y scale. yscale <- 1 @@ -241,8 +241,8 @@ eafplot.default <- xlim = xlim, ylim = ylim, log = log, axes = FALSE, las = las, panel.first = ({ if (axes) { - plot.eaf.axis(xaxis.side, xlab, las = las, sci.notation = sci.notation) - plot.eaf.axis(yaxis.side, ylab, las = las, sci.notation = sci.notation, + plot_eaf_axis(xaxis.side, xlab, las = las, sci.notation = sci.notation) + plot_eaf_axis(yaxis.side, ylab, las = las, sci.notation = sci.notation, # FIXME: eafplot uses 2.2, why the difference? line = 2.75) } @@ -260,14 +260,14 @@ eafplot.default <- } else if (length(col) != length(attsurfs)) { stop ("length(col) != 2, but with 'type=area', eafplot.default needs just two colors") } - plot.eaf.full.area(attsurfs, extreme, maximise, col = col) + plot_eaf_full_area(attsurfs, extreme, maximise, col = col) } else { ## Recycle values lwd <- rep(lwd, length=length(attsurfs)) lty <- rep(lty, length=length(attsurfs)) col <- rep(col, length=length(attsurfs)) if (!is.null(pch)) pch <- rep(pch, length=length(attsurfs)) - plot.eaf.full.lines(attsurfs, extreme, maximise, + plot_eaf_full_lines(attsurfs, extreme, maximise, col = col, lty = lty, lwd = lwd, pch = pch, cex = cex.pch) } }), ...) @@ -365,7 +365,7 @@ prettySciNotation <- function(x, digits = 1L) list(base = base, exponent = exponent))) } -axis.side <- function(side) +axis_side <- function(side) { if (!is.character(side)) return(side) return(switch(side, @@ -375,11 +375,11 @@ axis.side <- function(side) right = 4)) } -plot.eaf.axis <- function(side, lab, las, +plot_eaf_axis <- function(side, lab, las, col = 'lightgray', lty = 'dotted', lwd = par("lwd"), line = 2.1, sci.notation = FALSE) { - side <- axis.side(side) + side <- axis_side(side) ## FIXME: Do we still need lwd=0.5, lty="26" to work-around for R bug? at <- axTicks(if (side %% 2 == 0) 2 else 1) labels <- if (sci.notation) prettySciNotation(at) else formatC(at, format = "g") @@ -409,7 +409,7 @@ plot.eaf.axis <- function(side, lab, las, las = 0) } -plot.eaf.full.lines <- function(attsurfs, extreme, maximise, +plot_eaf_full_lines <- function(attsurfs, extreme, maximise, col, lty, lwd, pch = NULL, cex = par("cex")) { ## Recycle values @@ -419,7 +419,7 @@ plot.eaf.full.lines <- function(attsurfs, extreme, maximise, if (!is.null(pch)) pch <- rep(pch, length = length(attsurfs)) - attsurfs = lapply(attsurfs, add.extremes, extreme, maximise) + attsurfs = lapply(attsurfs, add_extremes, extreme, maximise) for (k in seq_along(attsurfs)) { # FIXME: Is there a way to plot points and steps in one call? if (!is.null(pch)) @@ -428,17 +428,17 @@ plot.eaf.full.lines <- function(attsurfs, extreme, maximise, } } -plot.eaf.full.area <- function(attsurfs, extreme, maximise, col) +plot_eaf_full_area <- function(attsurfs, extreme, maximise, col) { stopifnot(length(attsurfs) == length(col)) for (i in seq_along(attsurfs)) { - poli <- add.extremes(points.steps(attsurfs[[i]]), extreme, maximise) + poli <- add_extremes(points_steps(attsurfs[[i]]), extreme, maximise) poli <- rbind(poli, extreme) polygon(poli[,1], poli[,2], border = NA, col = col[i]) } } -plot.eafdiff.side <- function (eafdiff, attsurfs = list(), +plot_eafdiff_side <- function (eafdiff, attsurfs = list(), col, side = stop("Argument 'side' is required"), type = "point", @@ -480,7 +480,7 @@ plot.eafdiff.side <- function (eafdiff, attsurfs = list(), # will override the grid lines. col[col %in% c("white", "#FFFFFF")] <- "transparent" - extreme <- get.extremes(xlim, ylim, maximise, log) + extreme <- get_extremes(xlim, ylim, maximise, log) yscale <- 1 ## FIXME log == "y" and yscaling # yscale <- 60 @@ -497,18 +497,18 @@ plot.eafdiff.side <- function (eafdiff, attsurfs = list(), plot(xlim, ylim, type = "n", xlab = "", ylab = "", xlim = xlim, ylim = ylim, log = log, axes = FALSE, las = las, panel.first = ({ - plot.eaf.axis (xaxis.side, xlab, las = las, sci.notation = sci.notation) - plot.eaf.axis (yaxis.side, ylab, las = las, sci.notation = sci.notation, + plot_eaf_axis (xaxis.side, xlab, las = las, sci.notation = sci.notation) + plot_eaf_axis (yaxis.side, ylab, las = las, sci.notation = sci.notation, line = 2.2) if (nrow(eafdiff)) { if (type == "area") { if (full.eaf) { - plot.eaf.full.area(split.data.frame(eafdiff[,1:2], eafdiff[,3]), + plot_eaf_full_area(split.data.frame(eafdiff[,1:2], eafdiff[,3]), extreme, maximise, col) } else { - eafdiff[,1] <- rm.inf(eafdiff[,1], extreme[1]) - eafdiff[,2] <- rm.inf(eafdiff[,2], extreme[2]) + eafdiff[,1] <- rm_inf(eafdiff[,1], extreme[1]) + eafdiff[,2] <- rm_inf(eafdiff[,2], extreme[2]) polycol <- attr(eafdiff, "col") #print(unique(polycol)) #print(length(col)) @@ -544,7 +544,7 @@ plot.eafdiff.side <- function (eafdiff, attsurfs = list(), col <- c("black") } - plot.eaf.full.lines(attsurfs, extreme, maximise, + plot_eaf_full_lines(attsurfs, extreme, maximise, col = col, lty = lty, lwd = lwd) mtext(title, 1, line = 3.5, cex = par("cex.lab"), las = 0, font = 2) box() @@ -705,7 +705,7 @@ eafdiffplot <- type <- match.arg (type, c("point", "area")) # FIXME: check that it is either an integer or a character vector. if (length(intervals) == 1) { - intervals <- seq.intervals.labels( + intervals <- seq_intervals_labels( round(seq(0,1 , length.out = 1 + intervals), 4), digits = 1) } if (is.function(col)) { # It is a color-map, like viridis() @@ -728,17 +728,17 @@ eafdiffplot <- stop("length of maximise must be either 1 or 2") } - data.left <- check.eaf.data(data.left) - data.left[,1:2] <- matrix.maximise(data.left[,1:2, drop=FALSE], maximise) - data.right <- check.eaf.data(data.right) - data.right[,1:2] <- matrix.maximise(data.right[,1:2, drop=FALSE], maximise) + data.left <- check_eaf_data(data.left) + data.left[,1:2] <- matrix_maximise(data.left[,1:2, drop=FALSE], maximise) + data.right <- check_eaf_data(data.right) + data.right[,1:2] <- matrix_maximise(data.right[,1:2, drop=FALSE], maximise) attsurfs.left <- attsurfs.right <- list() if (!any(is.na(percentiles))) { - attsurfs.left <- compute.eaf.as.list (data.left, percentiles) - attsurfs.left <- lapply(attsurfs.left, matrix.maximise, maximise = maximise) - attsurfs.right <- compute.eaf.as.list (data.right, percentiles) - attsurfs.right <- lapply(attsurfs.right, matrix.maximise, maximise = maximise) + attsurfs.left <- compute_eaf_as_list (data.left, percentiles) + attsurfs.left <- lapply(attsurfs.left, matrix_maximise, maximise = maximise) + attsurfs.right <- compute_eaf_as_list (data.right, percentiles) + attsurfs.right <- lapply(attsurfs.right, matrix_maximise, maximise = maximise) } # FIXME: We do not need this for the full EAF. @@ -751,12 +751,12 @@ eafdiffplot <- if (full.eaf) { if (type == "area") { lower.boundaries <- 0:(length(intervals)-1) * 100 / length(intervals) - diff_left <- compute.eaf (data.left, percentiles = lower.boundaries) - diff_right <- compute.eaf (data.right, percentiles = lower.boundaries) + diff_left <- compute_eaf (data.left, percentiles = lower.boundaries) + diff_right <- compute_eaf (data.right, percentiles = lower.boundaries) } else if (type == "point") { - diff_left <- compute.eaf (data.left) - diff_right <- compute.eaf (data.right) - # Since plot.eafdiff.side uses floor to calculate the color, and + diff_left <- compute_eaf (data.left) + diff_right <- compute_eaf (data.right) + # Since plot_eafdiff_side uses floor to calculate the color, and # we want color[100] == color[99]. diff_left[diff_left[,3] == 100, 3] <- 99 diff_right[diff_right[,3] == 100, 3] <- 99 @@ -767,10 +767,10 @@ eafdiffplot <- #remove(data.left,data.right,data.combined) # Free memory? } else { if (type == "area") { - DIFF <- compute.eafdiff.polygon (data.combined, intervals = length(intervals)) + DIFF <- compute_eafdiff_polygon (data.combined, intervals = length(intervals)) } else if (type == "point") { #remove(data.left,data.right) # Free memory? - DIFF <- compute.eafdiff (data.combined, intervals = length(intervals)) + DIFF <- compute_eafdiff (data.combined, intervals = length(intervals)) #remove(data.combined) # Free memory? } diff_left <- DIFF$left @@ -778,21 +778,21 @@ eafdiffplot <- } # FIXME: This can be avoided and just taken from the full EAF. - grand.attsurf <- compute.eaf.as.list (data.combined, c(0, 100)) + grand.attsurf <- compute_eaf_as_list (data.combined, c(0, 100)) grand.best <- grand.attsurf[["0"]] grand.worst <- grand.attsurf[["100"]] - xlim <- get.xylim(xlim, maximise[1], + xlim <- get_xylim(xlim, maximise[1], data = c(grand.best[,1], grand.worst[,1], - range.finite(diff_left[,1]), range.finite(diff_right[,1]))) - ylim <- get.xylim(ylim, maximise[2], + range_finite(diff_left[,1]), range_finite(diff_right[,1]))) + ylim <- get_xylim(ylim, maximise[2], data = c(grand.best[,2], grand.worst[,2], - range.finite(diff_left[,2]), range.finite(diff_right[,2]))) + range_finite(diff_left[,2]), range_finite(diff_right[,2]))) - grand.best <- matrix.maximise(grand.best, maximise) - grand.worst <- matrix.maximise(grand.worst, maximise) - diff_left[,1:2] <- matrix.maximise(diff_left[,1:2, drop=FALSE], maximise) - diff_right[,1:2] <- matrix.maximise(diff_right[,1:2, drop=FALSE], maximise) + grand.best <- matrix_maximise(grand.best, maximise) + grand.worst <- matrix_maximise(grand.worst, maximise) + diff_left[,1:2] <- matrix_maximise(diff_left[,1:2, drop=FALSE], maximise) + diff_right[,1:2] <- matrix_maximise(diff_right[,1:2, drop=FALSE], maximise) # FIXME: This does not generate empty space between the two plots, but the # plots are not squared. @@ -824,7 +824,7 @@ eafdiffplot <- attsurfs <- attsurfs.left } - plot.eafdiff.side (diff_left, + plot_eafdiff_side (diff_left, attsurfs = attsurfs, col = col, type = type, full.eaf = full.eaf, @@ -848,7 +848,7 @@ eafdiffplot <- } else { attsurfs <- attsurfs.right } - plot.eafdiff.side (diff_right, + plot_eafdiff_side (diff_right, attsurfs = attsurfs, col = col, type = type, full.eaf = full.eaf, @@ -861,10 +861,10 @@ eafdiffplot <- } # Create labels: -# eaf:::seq.intervals.labels(seq(0,1, length.out=5), digits = 1) +# eaf:::seq_intervals_labels(seq(0,1, length.out=5), digits = 1) # "[0.0, 0.2)" "[0.2, 0.4)" "[0.4, 0.6)" "[0.6, 0.8)" "[0.8, 1.0]" # FIXME: Add examples and tests -seq.intervals.labels <- function(s, first.open = FALSE, last.open = FALSE, +seq_intervals_labels <- function(s, first.open = FALSE, last.open = FALSE, digits = NULL) { # FIXME: This should use: @@ -977,13 +977,13 @@ eafplot.list <- function(x, ...) groups <- if (!is.null(names(x))) names(x) else 1:length(x) - check.elem <- function(elem) { - elem <- check.eaf.data(elem) + check_elem <- function(elem) { + elem <- check_eaf_data(elem) if (ncol(elem) != 3L) - stop("Each element of the list have exactly three columns. If you have grouping and conditioning variables, please consider using this format: 'eafplot(formula, data, ...)'") + stop("Each element of the list have exactly three columns. If you have grouping and conditioning variables, please consider using this format: 'eafplot.formula, data, ...)'") return(elem) } - x <- lapply(x, check.elem) + x <- lapply(x, check_elem) groups <- rep(groups, sapply(x, nrow)) x <- do.call(rbind, x) diff --git a/R/nondominated.R b/R/nondominated.R index c65d471..7c7b446 100644 --- a/R/nondominated.R +++ b/R/nondominated.R @@ -101,7 +101,7 @@ pareto_rank <- function(data, maximise = FALSE) nobjs <- ncol(data) npoints <- nrow(data) maximise <- as.logical(rep_len(maximise, nobjs)) - data <- matrix.maximise(data, maximise) + data <- matrix_maximise(data, maximise) return(.Call(pareto_ranking_C, as.double(t(data)), as.integer(nobjs), diff --git a/R/vorob.R b/R/vorob.R index e48dc47..db6d1e5 100644 --- a/R/vorob.R +++ b/R/vorob.R @@ -35,7 +35,7 @@ #' @export vorobT <- function(x, reference) { - x <- check.eaf.data(x) + x <- check_eaf_data(x) setcol <- ncol(x) nobjs <- setcol - 1L @@ -81,10 +81,10 @@ vorobDev <- function(x, VE, reference) x.split <- split.data.frame(x[,1:nobjs, drop=FALSE], x[,setcol]) H1 <- mean(sapply(x.split, hypervolume, reference = reference)) - hv.union.VE <- function(y) - return(hypervolume(rbind(y[, 1:nobjs, drop=FALSE], VE), reference = reference)) + hv_union_VE <- function(y) + hypervolume(rbind(y[, 1:nobjs, drop=FALSE], VE), reference = reference) - VD <- 2 * sum(sapply(x.split, hv.union.VE)) + VD <- 2 * sum(sapply(x.split, hv_union_VE)) nruns <- length(x.split) return((VD / nruns) - H1 - H2) } @@ -131,8 +131,8 @@ symDifPlot <- function(x, VE, threshold, nlevels = 11, { # FIXME: These maybe should be parameters of the function in the future. maximise <- c(FALSE, FALSE) - xaxis.side <- "below" - yaxis.side <- "left" + xaxis_side <- "below" + yaxis_side <- "left" log <- "" xlab <- colnames(x)[1] ylab <- colnames(x)[2] @@ -143,7 +143,7 @@ symDifPlot <- function(x, VE, threshold, nlevels = 11, threshold <- round(threshold, 4) seq.levs <- round(seq(0, 100, length.out = nlevels), 4) levs <- sort.int(unique.default(c(threshold, seq.levs))) - attsurfs <- compute.eaf.as.list(x, percentiles = levs) + attsurfs <- compute_eaf_as_list(x, percentiles = levs) # Denote p_n the attainment probability, the value of the symmetric # difference function is p_n if p_n < alpha (Vorob'ev threshold) and 1 - p_n @@ -165,25 +165,25 @@ symDifPlot <- function(x, VE, threshold, nlevels = 11, names(levs) <- cols # FIXME: We should take the range from the attsurfs to not make x mandatory. - xlim <- get.xylim(xlim, maximise[1], data = x[,1]) - ylim <- get.xylim(ylim, maximise[2], data = x[,2]) - extreme <- get.extremes(xlim, ylim, maximise, log = log) + xlim <- get_xylim(xlim, maximise[1], data = x[,1]) + ylim <- get_xylim(ylim, maximise[2], data = x[,2]) + extreme <- get_extremes(xlim, ylim, maximise, log = log) plot(xlim, ylim, type = "n", xlab = "", ylab = "", xlim = xlim, ylim = ylim, log = log, axes = FALSE, las = las, main = main, panel.first = { - plot.eaf.full.area(attsurfs, extreme = extreme, maximise = maximise, col = cols) + plot_eaf_full_area(attsurfs, extreme = extreme, maximise = maximise, col = cols) # We place the axis after so that we get grid lines. - plot.eaf.axis (xaxis.side, xlab, las = las, sci.notation = sci.notation) - plot.eaf.axis (yaxis.side, ylab, las = las, sci.notation = sci.notation, + plot_eaf_axis (xaxis_side, xlab, las = las, sci.notation = sci.notation) + plot_eaf_axis (yaxis_side, ylab, las = las, sci.notation = sci.notation, line = 2.2) - plot.eaf.full.lines(list(VE), extreme, maximise, + plot_eaf_full_lines(list(VE), extreme, maximise, col = ve.col, lty = 1, lwd = 2) }) # Use first.open to print "(0,X)", because the color for 0 is white. - intervals <- seq.intervals.labels(seq.levs, first.open = TRUE) + intervals <- seq_intervals_labels(seq.levs, first.open = TRUE) intervals <- intervals[1:max.interval] names(intervals) <- names(colscale) #names(intervals) <- names(colscale[1:max.interval]) diff --git a/man/attsurf2df.Rd b/man/attsurf2df.Rd index 6d1f0b7..68f1854 100644 --- a/man/attsurf2df.Rd +++ b/man/attsurf2df.Rd @@ -9,7 +9,7 @@ attsurf2df(x) \arguments{ \item{x}{(\code{list()}) List of data.frames or matrices. The names of the list give the percentiles of the attainment surfaces. This is the format -returned by \code{\link[=eafplot]{eafplot()}} (and the internal function \code{compute.eaf.as.list}).} +returned by \code{\link[=eafplot]{eafplot()}} (and the internal function \code{compute_eaf_as_list}).} } \value{ A data.frame with as many columns as objectives and an additional column \code{percentiles}. diff --git a/tests/testthat/test-eaf.R b/tests/testthat/test-eaf.R index 982c576..edbf346 100644 --- a/tests/testthat/test-eaf.R +++ b/tests/testthat/test-eaf.R @@ -4,7 +4,7 @@ test_that("eaf", { test.eaf.dataset <- function(name, percentiles = NULL) { dataset <- get(name) - x <- eaf:::compute.eaf(dataset, percentiles) + x <- eaf:::compute_eaf(dataset, percentiles) # FIXME: work-around for change in the computation x[,3] <- floor(x[,3]) #saveRDS(x, paste0(name, "-eaf.rds")) @@ -12,7 +12,7 @@ test_that("eaf", { } test.eaf.file <- function(file, percentiles = NULL) { dataset <- read_datasets(file) - x <- eaf:::compute.eaf(dataset, percentiles) + x <- eaf:::compute_eaf(dataset, percentiles) #saveRDS(x, paste0(basename(file), "-eaf.rds")) return(x) } @@ -39,7 +39,7 @@ test_that("eaf3d", { data.combined[, nobjs + 1] <- data.combined[, nobjs + 1] + nruns.left data.combined <- rbind(lin, data.combined) # This may stop working once we filter uninteresting values in the C code directly. - DIFF <- eaf:::compute.eafdiff.helper(data.combined, intervals = nruns.left) + DIFF <- eaf:::compute_eafdiff_helper(data.combined, intervals = nruns.left) x <- as.matrix(read.table("lin.S-sph.S-diff.txt.xz", header = FALSE)) dimnames(x) <- NULL x[, nobjs + 1] <- x[, nobjs + 1] - x[, nobjs + 2]