Skip to content

Commit

Permalink
docs: small updates/fixes in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Dec 9, 2024
1 parent d01763f commit bd56acf
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 36 deletions.
18 changes: 9 additions & 9 deletions R/MsBackend.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@
#' parameter `spectraVariables` and in the same order.
#'
#' @param y For `cbind2()`: A `data.frame` or `DataFrame` with the
#' spectra variables to be added to the backend. Need to be of the same
#' length as the number of spectra in the backend. The number of rows and
#' their order has to match the number of spectra and their order in x.
#' spectra variables to be added to the backend. The number of rows of `y`
#' and their order have to match the number of spectra and their order
#' in `x`.
#'
#' @param x Object extending `MsBackend`.
#'
Expand Down Expand Up @@ -318,11 +318,11 @@
#' `dropNaSpectraVariables()` might still show columns containing `NA` values
#' for *core* spectra variables.
#'
#' - `cbind2()`: allows to appends multiple spectra variables to the backend at
#' once. The `Spectra` and the values for the new spectra variables have to
#' be in a matching order. Replacing existing spectra variables is not
#' supported through this function. For a more controlled way of adding
#' spectra variables, the `joinSpectraData()` should be used.
#' - `cbind2()`: allows to appends multiple new spectra variables to the
#' backend at once. The values for the new spectra variables have to
#' be in the same order as the spectra in `x`. Replacing existing spectra
#' variables is not supported through this function. For a more controlled
#' way of adding spectra variables, the `joinSpectraData()` should be used.
#'
#' - `centroided()`, `centroided<-`: gets or sets the centroiding
#' information of the spectra. `centroided()` returns a `logical`
Expand Down Expand Up @@ -1044,7 +1044,7 @@ setMethod("cbind2", signature = c("MsBackend", "dataframeOrDataFrameOrmatrix"),
function(x, y = data.frame(), ...) {
if (is(y, "matrix"))
y <- as.data.frame(y)
if (any(colnames(spectraData(x)) %in% colnames(y)))
if (any(spectraVariables(x) %in% colnames(y)))
stop("spectra variables in 'y' are already present in 'x' ",
"replacing them is not allowed")
if (nrow(y) != length(x))
Expand Down
2 changes: 1 addition & 1 deletion R/MsBackendDataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ setMethod("cbind2", signature = c("MsBackendDataFrame",
function(x, y = data.frame(), ...) {
if (is(y, "matrix"))
y <- as.data.frame(y)
if (any(colnames(spectraData(x)) %in% colnames(y)))
if (any(spectraVariables(x) %in% colnames(y)))
stop("spectra variables in 'y' are already present in 'x' ",
"replacing them is not allowed")
if (nrow(y) != length(x))
Expand Down
2 changes: 1 addition & 1 deletion R/MsBackendMemory.R
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ setMethod("cbind2", signature = c("MsBackendMemory",
function(x, y = data.frame(), ...) {
if (is(y, "matrix"))
y <- as.data.frame(y)
if (any(colnames(spectraData(x)) %in% colnames(y)))
if (any(spectraVariables(x) %in% colnames(y)))
stop("spectra variables in 'y' are already present in 'x' ",
"replacing them is not allowed")

Expand Down
16 changes: 7 additions & 9 deletions R/Spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -1465,14 +1465,12 @@ setReplaceMethod("[[", "Spectra", function(x, i, j, ..., value) {
#' the [applyProcessing()] function.
#'
#' - `cbind2()`: Appends multiple spectra variables from a `data.frame`,
#' `DataFrame` or `matrix` to the `Spectra` object at once. It does so
#' *blindly* (e.g. do not check rownames compatibility) and is therefore at
#' the risk of the user. The function also does not allow to replace existing
#' spectra variables. For a more controlled way of adding spectra
#' variables, the `joinSpectraData()` should be used. It will return a
#' `Spectra` object with the appended spectra variables. `cbind2()` does
#' check however that the number of rows of the `data.frame` or `DataFrame`
#' matches the number of spectra in the `Spectra` object.
#' `DataFrame` or `matrix` to the `Spectra` object at once. The order of
#' the values (rows) in `y` has to match the order of spectra in `x`. The
#' function does not allow to replace existing spectra variables. `cbind2()`
#' returns a `Spectra` object with the appended spectra variables. For a more
#' controlled way of adding spectra variables, see the `joinSpectraData()`
#' function.
#'
#' - `combineSpectra()`: combines sets of spectra (defined with parameter `f`)
#' into a single spectrum per set aggregating their MS data (i.e. their
Expand Down Expand Up @@ -1696,7 +1694,7 @@ setMethod("cbind2", signature(x = "Spectra",
y = "dataframeOrDataFrameOrmatrix"),
function(x, y, ...) {
x@backend <- cbind2(x@backend, y, ...)
})
})

#' @rdname combineSpectra
setMethod("split", "Spectra", function(x, f, drop = FALSE, ...) {
Expand Down
16 changes: 8 additions & 8 deletions man/MsBackend.Rd

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

14 changes: 6 additions & 8 deletions man/combineSpectra.Rd

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

0 comments on commit bd56acf

Please sign in to comment.