Skip to content

Commit

Permalink
ensure ellipses (...) are empty using rlang::check_dots_empty()
Browse files Browse the repository at this point in the history
  • Loading branch information
japhir committed May 4, 2024
1 parent 7a07670 commit debdf4e
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 34 deletions.
3 changes: 2 additions & 1 deletion R/abundance_ratios.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @param R47 Desired new name of the calculated ratio for mass 47.
#' @param R48 Desired new name of the calculated ratio for mass 48.
#' @param R49 Desired new name of the calculated ratio for mass 49.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
abundance_ratios <- function(.data,
Expand All @@ -26,6 +26,7 @@ abundance_ratios <- function(.data,
R45 = R45, R46 = R46, R47 = R47,
R48 = R48, R49 = R49,
quiet = NULL) {
rlang::check_dots_empty0(...)
# global variables and defaults
s44 <- s45 <- s46 <- s47 <- s48 <- s49 <- NULL

Expand Down
3 changes: 2 additions & 1 deletion R/acid_fractionation.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param D47 The column name of the \eqn{\Delta_47} values to use for the acid
#' fractionation calculation.
#' @param D47_out The desired new column name.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#'
#' @references
Expand All @@ -34,6 +34,7 @@ acid_fractionation <- function(.data, aff = 0.062, ...,
D47 = D47_etf,
D47_out = D47_final,
quiet = default(quiet)) {
rlang::check_dots_empty0(...)
# global variables and defaults
D47_etf <- D47_final <- NULL

Expand Down
3 changes: 2 additions & 1 deletion R/add_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
#' @param .info A [tibble][tibble::tibble-package], resulting from
#' [clean_did_info()].
#' @param cols A character vector with column names in info to add to the data.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
#' @family metadata cleaning functions
add_info <- function(.data, .info, ...,
cols = NULL, quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0) {
return(tibble(file_id = character()))
}
Expand Down
3 changes: 2 additions & 1 deletion R/append_expected_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#'
#' @export
#' @family empirical transfer functions
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
append_expected_values <- function(.data,
...,
Expand All @@ -39,6 +39,7 @@ append_expected_values <- function(.data,
quiet = NULL) {
# global variables and defaults
`Identifier 1` <- expected_D47 <- NULL
rlang::check_dots_empty0(...)

if (length(std_names) != length(std_values))
stop("std_names should be of equal length to std_values.")
Expand Down
3 changes: 2 additions & 1 deletion R/apply_etf.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
#' @param raw The column with raw values to apply the ETF to.
#' @param out The new column name.
#' @family empirical transfer functions
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
apply_etf <- function(.data, ..., intercept = intercept, slope = slope, raw = D47_raw, out = D47_etf, quiet = NULL) {
# defaults
D47_raw <- D47_etf <- NULL
rlang::check_dots_empty0(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down
3 changes: 2 additions & 1 deletion R/bulk_and_clumping_deltas.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @param d49 Column name of d49.
#' @inheritParams isobar_ratios
#' @inheritParams default.params
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @references Daeron, M., Blamart, D., Peral, M., & Affek, H. P., Absolute
#' isotopic abundance ratios and the accuracy of \eqn{\Delta_{47}}
Expand All @@ -36,6 +36,7 @@ bulk_and_clumping_deltas <- function(.data, ...,
R18_PDBCO2 = default(R18_PDBCO2),
lambda = default(lambda),
D17O = default(D17O), quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down
3 changes: 2 additions & 1 deletion R/calculate_etf.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param intercept The column name of the new intercept.
#' @param parallel Whether or not (default) to process this in parallel, using package `furrr`.
#' @importFrom stats na.exclude
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @family empirical transfer functions
#' @export
Expand All @@ -20,6 +20,7 @@ calculate_etf <- function(.data, ...,
session = Preparation, etf = etf,
etf_coefs = etf_coefs, slope = slope,
intercept = intercept, parallel = FALSE, quiet = NULL) {
rlang::check_dots_empty(...)
# global variables and defaults
if (parallel & !requireNamespace("furrr", quietly = TRUE)) {
stop("Package \"furrr\" is needed for this function to work.\n Please install it or run this with `parallel = FALSE`",
Expand Down
3 changes: 2 additions & 1 deletion R/clean_did_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
#' @seealso [isoreader::iso_read_dual_inlet()]
#' @seealso [isoreader::iso_get_file_info()]
#' @family metadata cleaning functions
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
clean_did_info <- function(.did, masspec = NULL, ...,
std_names = c(paste0("ETH-", 1:4), "IAEA-C2", "Merck"),
oth_name = "other",
quiet = NULL) {
rlang::check_dots_empty(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down
5 changes: 3 additions & 2 deletions R/collapse_cycles.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param alpha The confidence level for the summary functions.
#' @param na.rm a logical value indicating wheter NA values should be stripped
#' before the computation proceeds.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
collapse_cycles <- function(.data,
Expand All @@ -24,6 +24,7 @@ collapse_cycles <- function(.data,
na.rm = TRUE,
quiet = NULL) {
outlier_cycle <- d13C_PDB <- d18O_PDB <- D47_raw <- D47_final <- NULL
rlang::check_dots_empty0(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down Expand Up @@ -65,6 +66,7 @@ collapse_cycles <- function(.data,
#' columns that have cycle information based on previous computation steps.
#'
#' @param .data A [tibble][tibble::tibble-package] resulting from [bulk_and_clumping_deltas()].
#' @param ... Additional chacter vectors to nest by.
#' @param masses The masses that are present in the mass spectrometer. Defaults to 44:49 and 54.
#' @param ratios Ratio columns, based on masses.
#' @param outlier_cycles Columns with outlier_cycle information.
Expand All @@ -80,7 +82,6 @@ collapse_cycles <- function(.data,
#' @param flags Flag columns.
#' @param Deltas Big delta values.
#' @param p49 Param 49.
#' @inheritParams dots
#' @inheritParams quiet
#' @export
nest_cycle_data <- function(.data,
Expand Down
3 changes: 2 additions & 1 deletion R/correct_backgrounds.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#' @param factor Factor by which to multiply the half-cup before subtraction.
#' @param i47 Column with mass 47 intensities to correct.
#' @param i54 Column with mass 47.5 intensities to use for correction.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
correct_backgrounds <- function(.data, factor, ...,
i47 = v47.mV, i54 = v54.mV,
quiet = default(quiet)) {
# global variables and defaults
v47.mV <- v54.mV <- NULL
rlang::check_dots_empty0(...)

if (!quiet)
glue("Info: adding background based on half-mass with factor {factor}") %>%
Expand Down
3 changes: 2 additions & 1 deletion R/delta_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#' [correct_backgrounds()].
#' @details This function is a wrapper for the [abundance_ratios()],
#' [little_deltas()], and [bulk_and_clumping_deltas()] functions.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
delta_values <- function(.data, ..., quiet = NULL) {
R45_wg <- R46_wg <- R47_wg <- R48_wg <- R49_wg <- NULL
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down
3 changes: 2 additions & 1 deletion R/empirical_transfer_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @inheritParams append_expected_values
#' @inheritParams calculate_etf
#' @inheritParams apply_etf
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @details This function is a wrapper for [append_expected_values()],
#' [calculate_etf()], and [apply_etf()].
Expand Down Expand Up @@ -41,6 +41,7 @@ empirical_transfer_function <- function(.data,
parallel = FALSE) {
# defaults from above
D47_raw <- expected_D47 <- D47_etf <- `Identifier 1` <- Preparation <- NULL
rlang::check_dots_empty0(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down
3 changes: 2 additions & 1 deletion R/find_bad_cycles.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' @param cycle Column name of the column with the measurement cycle number.
#' @param relative_to cycle Drop detection occurs relative to either the first
#' cycle ("init", default) or to the previous cycle ("prev").
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
#' @family cycle functions
Expand All @@ -28,6 +28,7 @@ find_bad_cycles <- function(.data, ...,
v44 = "v44.mV", cycle = "cycle",
relative_to = "init",
quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down
21 changes: 14 additions & 7 deletions R/find_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' @param D47 The column with \eqn{\Delta_{47}} values.
#' @param session Column name that defines correction session.
#' @param id1 Column name of the sample/standard identifier.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
find_outliers <- function(.data,
Expand All @@ -36,6 +36,7 @@ find_outliers <- function(.data,
quiet = NULL) {
# default quoted arguments are bad, hmkay
D47_raw <- Preparation <- `Identifier 1` <- NULL
rlang::check_dots_empty0(...)

if (is.null(quiet)) {
quiet <- default(quiet)
Expand Down Expand Up @@ -72,13 +73,14 @@ find_outliers <- function(.data,
##' @param init_low Column in .data with minimum initial intensity threshold for mass 44.
##' @param init_high Column in .data with maximum initial intensity threshold for mass 44.
##' @param init_diff Column in .data with maximum initial difference in mass 44 threshold between standard and sample gas.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
##' @export
find_init_outliers <- function(.data,
init_low, init_high, init_diff,
...,
quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down Expand Up @@ -107,9 +109,10 @@ find_init_outliers <- function(.data,
##' Find measurements with a param49 value that is greater than \code{param49_off}.
##' @param .data A [tibble][tibble::tibble-package] with raw Delta values and file information.
##' @param param49_off The absolute cutoff value for the parameter 49 value.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
find_param49_outliers <- function(.data, param49_off, ..., quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand All @@ -134,12 +137,13 @@ find_param49_outliers <- function(.data, param49_off, ..., quiet = NULL) {
##' @param .data A [tibble][tibble::tibble-package] with raw Delta values and file information.
##' @param internal_sd The internal standard deviation cutoff value.
##' @param D47 The column to calculate the internal sd value for.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
##' @export
find_internal_sd_outlier <- function(.data, internal_sd = .15, ...,
D47 = D47_raw,
quiet = NULL) {
rlang::check_dots_empty0(...)
`Identifier 1` <- D47_raw <- NULL
if (is.null(quiet)) {
quiet <- default(quiet)
Expand All @@ -166,12 +170,13 @@ find_internal_sd_outlier <- function(.data, internal_sd = .15, ...,
#' @param session The session for which to calculate the standard deviation and median values.
#' @param outlier_session Column name of new output column.
#' @export
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
find_session_outlier <- function(.data, ...,
n = 5, nsd_off = 4, D47 = D47_raw, outlier_session = outlier_session_D47,
session = Preparation, quiet = NULL) {
D47_raw <- Preparation <- outlier_session_D47 <- NULL
rlang::check_dots_empty0(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down Expand Up @@ -200,13 +205,14 @@ find_session_outlier <- function(.data, ...,
#' @param D47 The column to calculate the internal sd value for.
#' @param session The session for which to calculate the standard deviation and median values.
#' @param id1 The column that defines the sample/standard name.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
##' @export
find_session_id1_outlier <- function(.data, ...,
n_id1 = 5, nsd_off = 4, D47 = D47_raw,
session = Preparation, id1 = `Identifier 1`, quiet = NULL) {
D47_raw <- Preparation <- `Identifier 1` <- outlier <- NULL
rlang::check_dots_empty0(...)

if (is.null(quiet)) {
quiet <- default(quiet)
Expand Down Expand Up @@ -235,10 +241,11 @@ find_session_id1_outlier <- function(.data, ...,
#'
#' @param .data A [tibble][tibble::tibble-package] with raw Delta values and file information.
#' @param out_column The name of the outlier column.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
summarise_outlier <- function(.data, out_column = outlier, ..., quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down
3 changes: 2 additions & 1 deletion R/isobar_ratios.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @param R48 The output column name for R48.
#' @param R49 The output column name for R49.
#' @inheritParams default.params
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#'
#' @references Daeron, M., Blamart, D., Peral, M., & Affek, H. P., Absolute
Expand All @@ -38,6 +38,7 @@ isobar_ratios <- function(.data,
D47 = default(D47),
D48 = default(D48),
D49 = default(D49)) {
rlang::check_dots_empty0(...)
.data %>%
mutate(
# Compute R17
Expand Down
3 changes: 2 additions & 1 deletion R/little_deltas.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#' \deqn{\delta_i = (R_i / R_iwg - 1) \times 1000}
#'
#' @param .data A [tibble][tibble::tibble-package] with abundance ratios.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
little_deltas <- function(.data, ..., quiet = NULL) {
rlang::check_dots_empty0(...)
if (nrow(.data) == 0L) {
return(tibble(file_id = character()))
}
Expand Down
3 changes: 2 additions & 1 deletion R/reference_gas_delta.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
#' @param .did An iso file, resulting from [isoreader::iso_read_dual_inlet()].
#' @param d13C_PDB_wg \eqn{\delta^{13}C} reference gas value to overwrite.
#' @param d18O_PDBCO2_wg \eqn{\delta^{18}O} reference gas value to overwrite.
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
append_ref_deltas <- function(.data, .did = NULL,
...,
d13C_PDB_wg = NULL,
d18O_PDBCO2_wg = NULL,
quiet = NULL) {
rlang::check_dots_empty0(...)
if (!any(class(.data) %in% c("data.frame", "tbl_df", "tbl"))) {
stop("`.data` must be a data.frame or tibble", call. = FALSE)
}
Expand Down
3 changes: 2 additions & 1 deletion R/remove_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' Preparation of the standards.
#' @param D47 The column with \eqn{\Delta_47} values. Defaults to `D47_raw_mean`.
#' @inheritParams find_outliers
#' @inheritParams dots
#' @inheritParams rlang::args_dots_empty
#' @inheritParams quiet
#' @export
remove_outliers <- function(.data,
Expand All @@ -30,6 +30,7 @@ remove_outliers <- function(.data,
quiet = NULL) {
# global variables and defaults
D47_raw <- file_datetime <- Preparation <- `Identifier 1` <- NULL
rlang::check_dots_empty0(...)
if (is.null(quiet)) {
quiet <- default(quiet)
}
Expand Down
Loading

0 comments on commit debdf4e

Please sign in to comment.