From 2efb0f3a974d55d3636a96145cdd6b97298900d5 Mon Sep 17 00:00:00 2001 From: Hugo Gruson <10783929+Bisaloo@users.noreply.github.com> Date: Sun, 23 Jun 2024 21:22:02 +0200 Subject: [PATCH] Switch if/else order --- R/get_spec.R | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/R/get_spec.R b/R/get_spec.R index 4fc89a8..b9fddec 100644 --- a/R/get_spec.R +++ b/R/get_spec.R @@ -80,11 +80,7 @@ lr_get_spec <- function(where = getwd(), ext = "txt", lim = c(300, 700), message(nb_files, " files found; importing spectra:") - if (!interpolate) { - gsp <- function(f) { - dispatch_parser(f, decimal = decimal, sep = sep)[[1]] - } - } else { + if (interpolate) { gsp <- function(f) { df <- dispatch_parser(f, decimal = decimal, sep = sep)[[1]] @@ -98,6 +94,11 @@ lr_get_spec <- function(where = getwd(), ext = "txt", lim = c(300, 700), call. = FALSE) return(NULL) } + } else { + gsp <- function(f) { + dispatch_parser(f, decimal = decimal, sep = sep)[[1]] + } + } df <- df[c(min(bounds) - 1, bounds, max(bounds) + 1), ]