Skip to content

Commit

Permalink
Remove unused ellipsis parameters
Browse files Browse the repository at this point in the history
Unused arguments were being passed in calls through ignored ellipsis.  These previously silent and inconsequential bugs started triggering warnings.  They are now fixed and if reintroduced, will trigger errors.
  • Loading branch information
aphalo committed Sep 12, 2024
1 parent 0199cb2 commit 35eea81
Show file tree
Hide file tree
Showing 29 changed files with 68 additions and 1,796 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: ggspectra
Type: Package
Title: Extensions to 'ggplot2' for Radiation Spectra
Version: 0.3.12.9002
Date: 2024-08-04
Date: 2024-09-12
Authors@R:
c(
person("Pedro J.", "Aphalo", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3385-972X")),
Expand Down
8 changes: 2 additions & 6 deletions R/autoplot-cps-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#' long form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -58,8 +57,7 @@ cps_plot <- function(spct,
facets,
ylim,
object.label,
na.rm,
...) {
na.rm) {
if (!is.cps_spct(spct)) {
stop("cps_plot() can only plot cps_spct objects.")
}
Expand Down Expand Up @@ -335,7 +333,6 @@ autoplot.cps_spct <-
cps_plot(spct = object,
w.band = w.band,
range = range,
norm = norm,
pc.out = pc.out,
label.qty = label.qty,
span = span,
Expand All @@ -347,8 +344,7 @@ autoplot.cps_spct <-
facets = facets,
ylim = ylim,
object.label = object.label,
na.rm = na.rm,
...) +
na.rm = na.rm) +
autotitle(object = object,
time.format = time.format,
tz = tz,
Expand Down
17 changes: 5 additions & 12 deletions R/autoplot-filter-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ R_plot <- function(spct,
#' (color coordinates) or a \code{\link[photobiology]{chroma_spct}} object.
#' @param na.rm logical.
#' @param ylim numeric y axis limits,
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -937,8 +936,7 @@ O_plot <- function(spct,
chroma.type,
facets,
na.rm,
ylim,
...) {
ylim) {
if (!is.object_spct(spct)) {
stop("O_plot() can only plot object_spct objects.")
}
Expand Down Expand Up @@ -1297,8 +1295,7 @@ autoplot.filter_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else if (plot.qty == "absorbance") {
out.ggplot <- A_plot(spct = object,
w.band = w.band,
Expand All @@ -1313,8 +1310,7 @@ autoplot.filter_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else if (plot.qty == "absorptance") {
out.ggplot <- Afr_plot(spct = object,
w.band = w.band,
Expand All @@ -1330,8 +1326,7 @@ autoplot.filter_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else {
stop("Invalid 'plot.qty' argument value: '", plot.qty, "'")
}
Expand Down Expand Up @@ -1822,8 +1817,7 @@ autoplot.object_spct <-
chroma.type = chroma.type,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
out.ggplot +
autotitle(object = object,
time.format = time.format,
Expand All @@ -1841,7 +1835,6 @@ autoplot.object_spct <-
stop("Invalid 'plot.qty' argument value: '", plot.qty, "'")
}
autoplot(object = object,
...,
w.band = w.band,
range = range,
norm = norm,
Expand Down
7 changes: 2 additions & 5 deletions R/autoplot-generic-spct.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#' long form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -58,8 +57,7 @@ generic_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!photobiology::is.generic_spct(spct)) {
stop("generic_plot() can only plot generic_spct objects.")
}
Expand Down Expand Up @@ -274,8 +272,7 @@ autoplot.generic_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...) +
na.rm = na.rm) +
autotitle(object = object,
time.format = time.format,
tz = tz,
Expand Down
8 changes: 2 additions & 6 deletions R/autoplot-raw-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#' long form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -60,8 +59,7 @@ raw_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!is.raw_spct(spct)) {
stop("raw_plot() can only plot response_spct objects.")
}
Expand Down Expand Up @@ -374,13 +372,11 @@ autoplot.raw_spct <-
pc.out = pc.out,
annotations = annotations,
geom = geom,
norm = norm,
text.size = text.size,
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...) +
na.rm = na.rm) +
autotitle(object = object,
time.format = time.format,
tz = tz,
Expand Down
16 changes: 4 additions & 12 deletions R/autoplot-response-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#' long form.
#' @param na.rm logical.
#' @param ylim numeric y axis limits,
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -56,8 +55,7 @@ e_rsp_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!is.response_spct(spct)) {
stop("e_Rsp_plot() can only plot response_spct objects.")
}
Expand Down Expand Up @@ -280,7 +278,6 @@ e_rsp_plot <- function(spct,
#' long form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -299,8 +296,7 @@ q_rsp_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!is.response_spct(spct)) {
stop("q_Rsp_plot() can only plot response_spct objects.")
}
Expand Down Expand Up @@ -643,13 +639,11 @@ autoplot.response_spct <-
wls.target = wls.target,
annotations = annotations,
geom = geom,
norm = norm, # read from object
text.size = text.size,
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else if (unit.out=="energy") {
out.ggplot <- e_rsp_plot(spct = object,
w.band = w.band,
Expand All @@ -660,13 +654,11 @@ autoplot.response_spct <-
wls.target = wls.target,
annotations = annotations,
geom = geom,
norm = norm,
text.size = text.size,
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else {
stop("Invalid 'unit.out' argument: '", unit.out, "'")
}
Expand Down
14 changes: 4 additions & 10 deletions R/autoplot-source-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#' long form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -61,8 +60,7 @@ e_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!is.source_spct(spct)) {
stop("e_plot() can only plot source_spct objects.")
}
Expand Down Expand Up @@ -331,7 +329,6 @@ e_plot <- function(spct,
#' form.
#' @param ylim numeric y axis limits,
#' @param na.rm logical.
#' @param ... currently ignored.
#'
#' @return a \code{ggplot} object.
#'
Expand All @@ -351,8 +348,7 @@ q_plot <- function(spct,
idfactor,
facets,
ylim,
na.rm,
...) {
na.rm) {
if (!is.source_spct(spct)) {
stop("q_plot() can only plot source_spct objects.")
}
Expand Down Expand Up @@ -825,8 +821,7 @@ autoplot.source_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else if (unit.out == "energy") {
out.ggplot <- e_plot(spct = object,
w.band = w.band,
Expand All @@ -842,8 +837,7 @@ autoplot.source_spct <-
idfactor = idfactor,
facets = facets,
ylim = ylim,
na.rm = na.rm,
...)
na.rm = na.rm)
} else {
stop("Invalid 'radiation.unit' argument value: '", unit.out, "'")
}
Expand Down
2 changes: 1 addition & 1 deletion R/axis-utils-calibration-spct.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' as character, expression (R default devices) or LaTeX (for tikz device).
#'
#' @param unit.exponent integer
#' @param format character string, "R", "R.expresion", "R.character", or
#' @param format character string, "R", "R.expression", "R.character", or
#' "LaTeX".
#' @param label.text character Textual portion of the labels.
#' @param scaled logical If \code{TRUE} relative units are assumed.
Expand Down
19 changes: 10 additions & 9 deletions R/ggplot-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ggplot.source_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -162,7 +162,7 @@ ggplot.response_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -209,7 +209,7 @@ ggplot.filter_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -247,7 +247,7 @@ ggplot.reflector_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -286,7 +286,7 @@ ggplot.cps_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -325,7 +325,7 @@ ggplot.calibration_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -364,7 +364,7 @@ ggplot.raw_spct <-
# private (not exported) method or function from 'ggplot2'
data.tb <- data
removed <- photobiology::rmDerivedSpct(data.tb)
p <- ggplot2::ggplot(data = data.tb, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data.tb, mapping = mapping,
environment = environment)
class(p[["data"]]) <- c(removed, class(p[["data"]]))

Expand Down Expand Up @@ -416,7 +416,7 @@ ggplot.object_spct <-
if (plot.qty == "as.is") {
data.class <- class(data)
photobiology::rmDerivedSpct(data)
p <- ggplot2::ggplot(data = data, mapping = mapping, ...,
p <- ggplot2::ggplot(data = data, mapping = mapping,
environment = environment)
class(p[["data"]]) <- data.class
} else {
Expand Down Expand Up @@ -479,7 +479,8 @@ ggplot.generic_spct <-
tibble = tibble::as_tibble)
spct <- funs[[spct_class]](data, ...)

ggplot2::ggplot(data = spct, mapping = mapping, ..., range = range,
# dispatched to one of the methods defined above
ggplot2::ggplot(data = spct, mapping = mapping, range = range,
environment = environment)
}

Expand Down
5 changes: 3 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ knitr::opts_chunk$set(

# ggspectra <img src="man/figures/logo.png" align="right" width="120" />

[![cran version](https://www.r-pkg.org/badges/version/ggspectra)](https://cran.r-project.org/package=ggspectra)
[![cran version](https://www.r-pkg.org/badges/version-last-release/ggspectra)](https://cran.r-project.org/package=ggspectra)
[![cran checks](https://badges.cranchecks.info/worst/ggspectra.svg)](https://cran.r-project.org/web/checks/check_results_ggspectra.html)
[![R build status](https://github.com/aphalo/ggspectra/workflows/R-CMD-check/badge.svg)](https://github.com/aphalo/ggspectra/actions)
[![photobiology status badge](https://aphalo.r-universe.dev/badges/ggspectra)](https://aphalo.r-universe.dev/ggspectra)
[![R-CMD-check](https://github.com/aphalo/ggspectra/workflows/R-CMD-check/badge.svg)](https://github.com/aphalo/ggspectra/actions)
[![Documentation](https://img.shields.io/badge/documentation-ggspectra-informational.svg)](https://docs.r4photobiology.info/ggspectra/)
[![doi](https://img.shields.io/badge/doi-10.32614/CRAN.package.ggspectra-blue.svg)](https://doi.org/10.32614/CRAN.package.ggspectra)

Expand Down
Loading

0 comments on commit 35eea81

Please sign in to comment.