Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
philouail committed Dec 4, 2024
1 parent c6bd03c commit 666172f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/Spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ setReplaceMethod("[[", "Spectra", function(x, i, j, ..., value) {
#' spectraData(sciex2)[1:13, c("spectrumId", "var1", "var2")]
#'
#' ## Append new spectra variables with cbind2()
#' df <- data.frame(cola = 4:5, colb = "b")
#' df <- data.frame(cola = seq_len(length(sciex1)), colb = "b")
#' data_append <- cbind2(sciex1, df)
NULL

Expand Down
6 changes: 6 additions & 0 deletions inst/test_backends/test_MsBackend/test_spectra_subsetting.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ test_that("cbind2 works", {
expect_equal(res$colz, rep("z", seql))
df2 <- data.frame(cola = 3:6, colb = "b", colz = "z")
expect_error(cbind2(be, df2), "does not match")
## with matrix
m <- matrix(1:seql, ncol = 1, dimnames = list(NULL, "m"))
res <- cbind2(be, m)
expect_true(validObject(res))
expect_equal(ncol(spectraData(res)), length(spectraVariables(be)) + 1)
expect_equal(res$m, 1:seql)
})

#' extractByIndex. Uses [ if not implemented
Expand Down
4 changes: 2 additions & 2 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 666172f

Please sign in to comment.