diff --git a/NEWS.md b/NEWS.md index bd85089..9ddd4f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -23,7 +23,7 @@ * New function `hy_browse_homepage()` opens the homepage of *R hyperSpec* in a web browser. * New function `hy_list_available_hySpc_packages()` lists packages, that are available in GitHub organization `r-hyperSpec`. * New function `hy_list_installed_hySpc_packages()` lists and function `hy_attach()` conveniently loads and attaches all installed **`r-hyperspec`** family packages (@cbeleites, @GegznaV, cbeleites/hyperSpec#219). -* New function `new_hyperSpec()` that initializes `hyperSpec` object in a similar way as `new("hyperSpec")` does but has autocompletion possibilities in RStudio (cbeleites/hyperSpec#283). +* New function `hyperSpec()` that initializes `hyperSpec` object in a similar way as `new("hyperSpec")` does but has autocompletion possibilities in RStudio (cbeleites/hyperSpec#283, #129). * New function `wl_convert_units()` (cbeleites/hyperSpec#300). * New function `wl_create_label_from_units()` that creates labels for wavelength axis (@GegznaV). * New method `as.hyperSpec()` (cbeleites/hyperSpec#282). @@ -39,7 +39,7 @@ * Function `sample()` gains new argument `index`; `sample(..., index = TRUE)` replaced function `isample()` (@GegznaV, #17). * Function `wl_convert_units()` converted into S3 generic. Default and hyperSpec methods were added (#29). * Dataset `faux_cell` and function `generate_faux_cell()` replace `chondro` dataset (cbeleites/hyperSpec#125, cbeleites/hyperSpec#156, cbeleites/hyperSpec#180, cbeleites/hyperSpec#229). - +* Documentation aliases have been updated. Now, ?hyperSpec points to the function `hyperSpec()`, and to refer to the package, `package?hyperSpec` should be used (#129). ### Bugfixes diff --git a/R/hyperspec-package.R b/R/hyperspec-package.R index 12dc3ae..37b793a 100644 --- a/R/hyperspec-package.R +++ b/R/hyperspec-package.R @@ -1,4 +1,7 @@ #' @name hyperSpec-package +#' @rdname hyperSpec-package +#' @aliases hyperSpec-package +#' #' @title Package "hyperSpec": interface for hyperspectral datasets #' @description #' This package gives an interface to handle hyperspectral data sets in R. @@ -20,13 +23,11 @@ #' - `package?hyperSpec` for information about the package. #' - `class?hyperSpec` for details on the S4 class provided by this package. #' -#' @rdname hyperSpec-package #' @include flu.R #' @include faux_cell.R #' @include laser.R #' @include paracetamol.R #' @include barbiturates.R - #' #' @keywords package #' @concept hyperSpec-main diff --git a/R/initialize.R b/R/initialize.R index 13e3ffb..36b0521 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -2,12 +2,12 @@ #' #' To create a new `hyperSpec` object, you can use one of the following functions: #' - [new()] (i.e., `new("hyperSpec", ...)`); -#' - `new_hyperSpec()`. +#' - `hyperSpec()`. #' #' @note #' #' A `hyperSpec` object is an S4 object, so its initialization is performed -#' by calling `new("hyperSpec", ...)`. The function `new_hyperSpec()` is provided +#' by calling `new("hyperSpec", ...)`. The function `hyperSpec()` is provided #' for convenience. #' #' @docType methods @@ -22,7 +22,7 @@ #' create,hyperSpec-method #' new #' new,hyperSpec-method -#' new_hyperSpec +#' hyperSpec-function #' #' @param spc (`matrix` or convertible to `matrix`) \cr #' A spectra matrix with spectra in rows and wavelength intensities in @@ -85,11 +85,11 @@ #' @examples #' #' new("hyperSpec") -#' new_hyperSpec() +#' hyperSpec() #' #' spc <- matrix(rnorm(12), ncol = 4) #' new("hyperSpec", spc = spc) -#' new_hyperSpec(spc = spc) +#' hyperSpec(spc = spc) #' #' new("hyperSpec", #' data = data.frame(x = letters[1:3]), @@ -263,7 +263,7 @@ NULL #' @rdname initialize #' @export -new_hyperSpec <- function(spc = NULL, data = NULL, wavelength = NULL, +hyperSpec <- function(spc = NULL, data = NULL, wavelength = NULL, labels = NULL, gc = hy_get_option("gc"), log = "ignored") { new("hyperSpec", spc = spc, data = data, wavelength = wavelength, @@ -398,11 +398,11 @@ hySpc.testthat::test(.initialize) <- function() { }) - test_that('new_hyperSpec() and new("hyperSpec") give identical results', { - expect_equal(new_hyperSpec(), new("hyperSpec")) - expect_equal(new_hyperSpec(spc = 1:4), new("hyperSpec", spc = 1:4)) + test_that('hyperSpec() and new("hyperSpec") give identical results', { + expect_equal(hyperSpec(), new("hyperSpec")) + expect_equal(hyperSpec(spc = 1:4), new("hyperSpec", spc = 1:4)) expect_equal( - new_hyperSpec(spc = spc, data = data.frame(x = 11:13)), + hyperSpec(spc = spc, data = data.frame(x = 11:13)), new("hyperSpec", spc = spc, data = data.frame(x = 11:13)) ) })