Skip to content

Commit

Permalink
Address rhub notes. Addresses #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
henningte committed Apr 21, 2022
1 parent cedf3fc commit 27dffb5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @source The data set was derived from <https://www.nature.com/articles/s41467-018-06050-2>
#' and published by \insertCite{Hodgkins.2018;textual}{ir} under the CC BY 4.0 license <https://creativecommons.org/licenses/by/4.0/>.
#' \insertCite{Hodgkins.2018;textual}{ir} originally derived the data on Klason Lignin and Holocellulose content from
#' \insertCite{LaCruz.2016;textual}{ir} <https://doi.org/10.1089/ees.2014.0402>.
#' \insertCite{LaCruz.2016;textual}{ir}.
#'
#' @references
#' \insertAllCited{}
Expand Down
2 changes: 1 addition & 1 deletion R/ir.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ ir_reclass_ir <- function(x) {

if(! "spectra" %in% colnames(x)) { # spectra column not present
structure(x, class = setdiff(class(x), "ir"))
} else if(class(try(ir_check_spectra(x$spectra), silent = TRUE)) == "try-error") { # spectra column present, but wrong format
} else if(inherits(try(ir_check_spectra(x$spectra), silent = TRUE), "try-error")) { # spectra column present, but wrong format
structure(x, class = setdiff(class(x), "ir"))
} else { # spectra column with correct format present
structure(x, class = c("ir", setdiff(class(x), "ir")))
Expand Down
6 changes: 6 additions & 0 deletions R/ir_bc.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,30 @@
#' `return_bl = TRUE`, the baselines instead of the spectra in column `spectra`.
#'
#' @examples
#' library(dplyr)
#'
#' # rubberband baseline correction
#' x1 <-
#' ir::ir_sample_data %>%
#' dplyr::slice(1:10) %>%
#' ir::ir_bc(method = "rubberband")
#'
#' # polynomial baseline correction
#' x2 <-
#' ir::ir_sample_data %>%
#' dplyr::slice(1:10) %>%
#' ir::ir_bc(method = "polynomial", degree = 2)
#'
#' # Savitzky-Golay baseline correction
#' x3 <-
#' ir::ir_sample_data %>%
#' dplyr::slice(1:10) %>%
#' ir::ir_bc(method = "sg", p = 3, n = 199, ts = 1, m = 0)
#'
#' # return the baseline instead of the baseline corrected spectra
#' x1_bl <-
#' ir::ir_sample_data %>%
#' dplyr::slice(1:10) %>%
#' ir::ir_bc(method = "rubberband", return_bl = TRUE)
#'
#' @export
Expand Down
6 changes: 6 additions & 0 deletions man/ir_bc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ir_sample_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27dffb5

Please sign in to comment.