Skip to content

Commit

Permalink
Deprecate makeraster and fitraster
Browse files Browse the repository at this point in the history
  • Loading branch information
GegznaV committed Dec 14, 2021
1 parent cbc1beb commit 9573b37
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions R/DEPRECATED-raster.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#' @name DEPRECATED-raster
#' @concept deprecated
#'
#' @title (DEPRECATED)
#' Find an evenly spaced grid for x
#'
#' @description
#' These \pkg{hyperSpec} functions are **deprecated** and not maintained any
#' more. You should not use these.
#' Currently they are present due to back-compatibility reasons and will be
#' removed in the next release of the package.
#' Please, use the suggested alternative functions instead:
#'
#' - [hyperSpec::raster_make()]
#' - [hyperSpec::raster_fit()]
#'
#'
#' @param ... arguments to [hyperSpec::raster_make()] and
#' [hyperSpec::raster_fit()].
#'
#' @include raster.R
#' @export
makeraster <- function(...) {
hySpc_deprecated("raster_make")
raster_make(...)
}

#' @rdname DEPRECATED-raster
#' @export
fitraster <- function(...) {
hySpc_deprecated("raster_fit")
raster_fit(...)
}


# Unit tests -----------------------------------------------------------------

hySpc.testthat::test(makeraster) <- function() {
context("Deprecated functions")

test_that("makeraster() and fitraster() are deprecated", {
expect_error(expect_warning(makeraster(), "deprecated"))
expect_error(expect_warning(fitraster(), "deprecated"))

x <- c(sample(1:20, 10), (0:5) + 0.5)
expect_warning(makeraster(x, x[1], 2), "deprecated")
expect_warning(fitraster(x), "deprecated")
})
}

0 comments on commit 9573b37

Please sign in to comment.