[Debichem-commits] New commit [r-cran-maldiquant]: 01/07: New upstream version 1.12

Sebastian Gibb sgibb-guest at moszumanska.debian.org
Sun Jun 14 11:38:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

sgibb-guest pushed a commit to branch master
in repository r-cran-maldiquant.

commit 9ad7fe1a37f87ab2522e52b1374415efd1c3eb5b
Author: Sebastian Gibb <mail at sebastiangibb.de>
Date:   Sun Jun 14 12:44:14 2015 +0200

    New upstream version 1.12
---
 DESCRIPTION                                        |  22 +-
 MD5                                                | 280 +++++++++++----------
 NAMESPACE                                          |   8 +
 NEWS                                               |  67 ++++-
 R/AllClasses.R                                     |   1 -
 R/AllGenerics.R                                    |  30 ++-
 R/Deprecated.R                                     |  74 +++++-
 R/alignSpectra-functions.R                         |   7 +-
 R/approxfun-methods.R                              |   7 +-
 R/{irregular-functions.R => as-methods.R}          |  21 +-
 R/as.matrix-functions.R                            |  23 +-
 R/as.matrix-methods.R                              |   5 +-
 R/averageMassSpectra-functions.R                   |  13 +-
 R/binPeaks-functions.R                             |  52 ++--
 R/calculateLabelPositions-methods.R                |  35 +--
 R/calibrateIntensity-functions.R                   |  21 +-
 R/calibrateIntensity-methods.R                     |  27 +-
 R/colMedians-functions.R                           |   3 +-
 R/constructor-functions.R                          |  10 +-
 R/coordinates-methods.R                            |  81 ++++++
 R/deprecated-functions.R                           |   7 +-
 R/detectPeaks-methods.R                            |  15 +-
 R/determineWarpingFunctions-functions.R            |  35 +--
 R/doByLabels-functions.R                           |   9 +-
 R/estimateBaseline-functions.R                     |  61 +++--
 R/estimateBaseline-methods.R                       |  28 +--
 R/estimateNoise-functions.R                        |  35 ++-
 R/estimateNoise-methods.R                          |   8 +-
 R/filterPeaks-functions.R                          |  13 +-
 R/findEmptyMassObjects-functions.R                 |   3 +-
 R/findLocalMaxima-methods.R                        |  11 +-
 R/grouper-functions.R                              |  25 +-
 R/intensity-methods.R                              |   7 +-
 R/intensityMatrix-functions.R                      |  13 +-
 R/irregular-functions.R                            |   3 +-
 R/isEmpty-methods.R                                |   8 +-
 R/isFunctionList-functions.R                       |   8 +-
 R/isMassObject-functions.R                         |   6 +-
 R/isMassObjectList-functions.R                     |  22 +-
 R/isRegular-methods.R                              |   3 +-
 R/isValidHalfWindowSize-functions.R                |   5 +-
 R/labelPeaks-methods.R                             |   5 +-
 R/{unlist-functions.R => lapply-functions.R}       |  15 +-
 R/length-methods.R                                 |   3 +-
 R/lines-methods.R                                  |   5 +-
 R/localMaxima-functions.R                          |   8 +-
 R/mapply-functions.R                               |   8 +-
 R/mass-methods.R                                   |   7 +-
 R/memoryUsage-functions.R                          |   7 +-
 R/merge-functions.R                                |  26 +-
 R/metaData-methods.R                               |   5 +-
 R/morphologicalFilter-functions.R                  |   5 +-
 R/msiSlices-functions.R                            |  67 +++++
 R/plot-methods.R                                   |   4 +-
 R/plotImsSlice-functions.R                         | 103 --------
 R/plotMsiSlice-functions.R                         | 139 ++++++++++
 R/plotMsiSlice-methods.R                           |  91 +++++++
 R/points-methods.R                                 |   1 -
 R/range-functions.R                                |   6 +-
 R/referencePeaks-functions.R                       |   3 +-
 R/removeBaseline-methods.R                         |  11 +-
 R/removeEmptyMassObjects-functions.R               |   4 +-
 R/replaceNegativeIntensityValues-functions.R       |   4 +-
 R/show-functions.R                                 |   5 +-
 R/show-methods.R                                   |   5 +-
 R/smoothIntensity-methods.R                        |  35 ++-
 R/smoothingFilters-functions.R                     |  34 ++-
 R/snr-methods.R                                    |   3 +-
 R/subset-methods.R                                 |   9 +-
 R/textLabelRects-functions.R                       |  15 +-
 R/totalIonCurrent-methods.R                        |   3 +-
 R/transformIntensity-methods.R                     |  21 +-
 R/trim-methods.R                                   |  15 +-
 R/unlist-functions.R                               |   1 -
 R/valid-methods.R                                  |   7 +-
 R/warp-functions.R                                 |  17 +-
 R/warpingFunction-functions.R                      |   9 +-
 R/which.closest-functions.R                        |   9 +-
 build/vignette.rds                                 | Bin 276 -> 276 bytes
 demo/baseline.R                                    |   1 -
 inst/doc/MALDIquant-intro.pdf                      | Bin 990121 -> 990016 bytes
 man/AbstractMassObject-class.Rd                    |  14 ++
 man/MALDIquant-defunct.Rd                          |   2 +
 man/MALDIquant-deprecated.Rd                       |  13 +-
 man/MALDIquant-package.Rd                          |   9 +-
 man/MALDIquant-parallel.Rd                         |  57 +++++
 man/alignSpectra-functions.Rd                      |   4 +-
 man/averageMassSpectra-functions.Rd                |   4 +-
 man/calibrateIntensity-methods.Rd                  |  13 +-
 man/createMassPeaks-functions.Rd                   |   2 +-
 man/detectPeaks-methods.Rd                         |   5 +-
 man/intensityMatrix-functions.Rd                   |   2 +-
 man/mergeMassPeaks-functions.Rd                    |   5 +-
 man/msiSlices-functions.Rd                         |  76 ++++++
 man/plotImsSlice-functions.Rd                      |  62 -----
 man/plotMsiSlice-methods.Rd                        | 114 +++++++++
 man/removeBaseline-methods.Rd                      |   4 +-
 man/transformIntensity-methods.Rd                  |   3 +
 man/trim-methods.Rd                                |   6 +-
 src/init.c                                         |   1 -
 src/localMaxima.c                                  |   1 -
 src/lowerConvexHull.c                              |   1 -
 src/morphologicalFilters.c                         |   1 -
 src/snip.c                                         |   1 -
 tests/testthat/test_approxfun-methods.R            |   1 -
 tests/testthat/test_as-methods.R                   |   8 +
 tests/testthat/test_as.matrix-functions.R          |   7 +-
 tests/testthat/test_averageMassSpectra-functions.R |   8 +-
 tests/testthat/test_calibrateIntensity-methods.R   |   3 +-
 tests/testthat/test_colMedians-functions.R         |   1 -
 tests/testthat/test_coordinates-methods.R          |  40 +++
 tests/testthat/test_deprecated-functons.R          |  20 +-
 tests/testthat/test_detectPeaks-methods.R          |   8 +-
 .../test_determineWarpingFunctions-functions.R     |   1 -
 tests/testthat/test_doByLabel-functions.R          |  10 +-
 tests/testthat/test_estimateBaseline-methods.R     |  86 +++----
 tests/testthat/test_estimateNoise-methods.R        |  23 +-
 .../testthat/test_findEmptyMassObjects-functions.R |   1 -
 tests/testthat/test_intensityMatrix-functions.R    |   5 +-
 tests/testthat/test_irregular-functions.R          |   1 -
 tests/testthat/test_isEmpty-methods.R              |   9 +-
 tests/testthat/test_isRegular-methods.R            |   1 -
 tests/testthat/test_length-methods.R               |   1 -
 tests/testthat/test_localMaxima-functions.R        |   1 -
 tests/testthat/test_mapply-functions.R             |   1 -
 tests/testthat/test_mass-methods.R                 |   1 -
 tests/testthat/test_merge-functions.R              |   1 -
 tests/testthat/test_metaData-methods.R             |   1 -
 .../testthat/test_morphologicalFilter-functions.R  |   1 -
 tests/testthat/test_msiSlices-functions.R          |  59 +++++
 tests/testthat/test_plotMsiSlice-functions.R       |  35 +++
 tests/testthat/test_range-functions.R              |   1 -
 tests/testthat/test_referencePeaks-functions.R     |   1 -
 tests/testthat/test_removeBaseline-methods.R       |  10 +-
 .../test_removeEmptyMassObjects-functions.R        |   1 -
 tests/testthat/test_show-methods.R                 | 103 +++++---
 tests/testthat/test_smoothIntensity-methods.R      |  17 +-
 tests/testthat/test_smoothingFilters-functions.R   |   1 -
 tests/testthat/test_snr-methods.R                  |   1 -
 tests/testthat/test_subset-methods.R               |   1 -
 tests/testthat/test_totalIonCurrent-methods.R      |   1 -
 tests/testthat/test_transformIntensity-methods.R   |   6 +-
 tests/testthat/test_trim-methods.R                 |   1 -
 tests/testthat/test_unlist-functions.R             |   1 -
 tests/testthat/test_valid-functions.R              |  25 ++
 tests/testthat/test_warp-functions.R               |   1 -
 tests/testthat/test_warpingFunctions-functions.R   |   1 -
 tests/testthat/test_which.closest-functions.R      |   1 -
 vignettes/bibliography.bib                         |   1 -
 149 files changed, 1729 insertions(+), 1007 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index e0bbc22..05782d2 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,28 +1,28 @@
 Package: MALDIquant
-Version: 1.11
-Date: 2014-08-11
+Version: 1.12
+Date: 2015-06-11
 Title: Quantitative Analysis of Mass Spectrometry Data
 Authors at R: c(person("Sebastian", "Gibb", role=c("aut", "cre"),
         email="mail at sebastiangibb.de"), person("Korbinian", "Strimmer",
         role="ths"))
 Depends: R (>= 3.0.0), methods
+Imports: parallel
 Suggests: knitr, testthat (>= 0.8)
-Description: MALDIquant provides a complete analysis pipeline for
-        MALDI-TOF and other mass spectrometry data. Distinctive
-        features include baseline subtraction methods such as TopHat or
-        SNIP, peak alignment using warping functions, handling of
-        replicated measurements as well as allowing spectra with
-        different resolutions.
+Description: A complete analysis pipeline for MALDI-TOF and other mass
+        spectrometry data. Distinctive features include baseline
+        subtraction methods such as TopHat or SNIP, peak alignment
+        using warping functions, handling of replicated measurements as
+        well as allowing spectra with different resolutions.
 License: GPL (>= 3)
 URL: http://strimmerlab.org/software/maldiquant/
         https://github.com/sgibb/MALDIquant/
 BugReports: https://github.com/sgibb/MALDIquant/issues/
 LazyLoad: yes
 VignetteBuilder: knitr
-Packaged: 2014-08-11 17:56:25 UTC; sebastian
+NeedsCompilation: yes
+Packaged: 2015-06-11 14:48:41 UTC; sebastian
 Author: Sebastian Gibb [aut, cre],
   Korbinian Strimmer [ths]
 Maintainer: Sebastian Gibb <mail at sebastiangibb.de>
-NeedsCompilation: yes
 Repository: CRAN
-Date/Publication: 2014-08-11 21:39:21
+Date/Publication: 2015-06-11 18:22:46
diff --git a/MD5 b/MD5
index 3dc8570..b941544 100644
--- a/MD5
+++ b/MD5
@@ -1,175 +1,187 @@
-f73323d8457eedf4003776ed07681ee7 *DESCRIPTION
-19d198d14e75ce349e1a56e34348334a *NAMESPACE
-6fc76c276cd6871ef6ee6018886dd179 *NEWS
-af35d49161d4c3ede189d11bb52ceaa7 *R/AllClasses.R
-8a5171f1b5e4d402b7c31e72c98520e8 *R/AllGenerics.R
-28e3509315ed75a3a36fc85d8cbd5135 *R/Deprecated.R
-b873a74569968e09ef69ea7b1c33e639 *R/alignSpectra-functions.R
-9d593c0b243fa8f5dbf4e79085c8683f *R/approxfun-methods.R
-6bb19116660388bdade12b274bdc3648 *R/as.matrix-functions.R
-4d3be472437f0cc9607b100b213e534e *R/as.matrix-methods.R
-b448406346f9406113b791665323624d *R/averageMassSpectra-functions.R
-1a77e4fcefb233f9b271bf41db619fa2 *R/binPeaks-functions.R
-4fd548b6a80994826d588c94f6f15255 *R/calculateLabelPositions-methods.R
-a818d929e95042af6d2371225c85febe *R/calibrateIntensity-functions.R
-814c016cad379a43b12b1d2e2b63169d *R/calibrateIntensity-methods.R
-2ae28c142a361a49a5a8537a20aefbb4 *R/colMedians-functions.R
-c43206c144c0be9440845eb8f4fb5bd4 *R/constructor-functions.R
-c4a18d7bdb1abe861f826ae14b3273f5 *R/deprecated-functions.R
-62ba782eb19470f55152b771107b6181 *R/detectPeaks-methods.R
-aa9b760b3084cb7df96cda35ae029f3d *R/determineWarpingFunctions-functions.R
-b948d3182c93ec9b740f6a6da0942a78 *R/doByLabels-functions.R
-e1730f2ac142dc175128bbc0ae282c52 *R/estimateBaseline-functions.R
-c1c9ab6bbb61a50127da142b705a2fce *R/estimateBaseline-methods.R
-2684cbfefe32be4a10c321f6d50eadd3 *R/estimateNoise-functions.R
-15cf2cfd04160686ecbf2ae0fd06f8b0 *R/estimateNoise-methods.R
-4aec612829572dc1f89efb45c6344e90 *R/filterPeaks-functions.R
-2c86eb3543af7d71262ddca2244a3a6f *R/findEmptyMassObjects-functions.R
-47976c467937248521dead20bf3ead59 *R/findLocalMaxima-methods.R
-73b4a3abb7274e6a61ea9f3d05e10576 *R/grouper-functions.R
-c5aab7df34bfb9dfaa2eddf8d01d1fa4 *R/intensity-methods.R
-c5a4dce5aba026c4bfa6ec6287299128 *R/intensityMatrix-functions.R
-d4f8d194b910778d2089a50d6afb7807 *R/irregular-functions.R
-742533f28abb0b0d545024c6d0ccf447 *R/isEmpty-methods.R
-ecc4accf68876e94b031734e47bf88c4 *R/isFunctionList-functions.R
-0e9bb031d1d928a0803ecba6ad903314 *R/isMassObject-functions.R
-59dc12204f8b94298db2e3d593918bb2 *R/isMassObjectList-functions.R
-567d03d3d65aef2ffc8a1f15a05c3204 *R/isRegular-methods.R
-95efbec8a53a6e08950ddce69c2808de *R/isValidHalfWindowSize-functions.R
-d6987dc0cceb070bd22953a46ba97233 *R/labelPeaks-methods.R
-3cd0653b5e0799489623f97da9e313ee *R/length-methods.R
-b262f628156dec1d1fb54afebd6cfb6c *R/lines-methods.R
-9f4ed09eeaf3dee9d02d24e3a00228ac *R/localMaxima-functions.R
-fa7cd41a0de21aa57648a28df1d7daa8 *R/mapply-functions.R
-bb19c9c548e9b9572153e1ebbf134594 *R/mass-methods.R
-88376299712dd24f6d308b1e3c7b1c86 *R/memoryUsage-functions.R
-367ed733f7bcbd1529c5f51a6024f743 *R/merge-functions.R
-c13f621346282d5e5e89a3bd479d7b2f *R/metaData-methods.R
-989a68ca184ab75f35984bfd08e01d98 *R/morphologicalFilter-functions.R
+4925cbb092cf43a8840c24ee1be82f17 *DESCRIPTION
+32c2bcd6ef70a8e320af379033aa4ed3 *NAMESPACE
+11db485dae4cff43cf66b2f34c1b101a *NEWS
+30b46222f944b3cdccb58d0376466bc2 *R/AllClasses.R
+53a5770caf5b3c6501725ba8902141bf *R/AllGenerics.R
+375d0ebe04d99f73a64b335528a93878 *R/Deprecated.R
+80eea460f3de1daa108797d20744a3b9 *R/alignSpectra-functions.R
+379b126cfa3d770d65bc45b0aa3921f3 *R/approxfun-methods.R
+bf9bfb611fdfd0f35b07e87e2ea6d380 *R/as-methods.R
+2f65bfdf4f0fe5cf88b512310a13c8f3 *R/as.matrix-functions.R
+962371a544f304d41c0f0f5d81ed5963 *R/as.matrix-methods.R
+d0054b8e432c9a7654a2c026276f3bbd *R/averageMassSpectra-functions.R
+7025a082c26b646ea919e7383b636f62 *R/binPeaks-functions.R
+d565e5b0660570c626d231f69747e867 *R/calculateLabelPositions-methods.R
+e06e6dd4e1d8c650618e14247b583d29 *R/calibrateIntensity-functions.R
+16ac971d9067d85b6a5508bf937c2762 *R/calibrateIntensity-methods.R
+35bf88e7a965dc3f503c21a462d0f726 *R/colMedians-functions.R
+3a5e00982d5928ff2072b0a657e19d88 *R/constructor-functions.R
+f040a98fa18e4bc4aeed5fda2dd5e07f *R/coordinates-methods.R
+714125dc102ccab1e46b86b84bf709c3 *R/deprecated-functions.R
+cf93b166ff2f2d27f6424646841a808d *R/detectPeaks-methods.R
+95d437252d195537fb3f3c2f7e1a7fc4 *R/determineWarpingFunctions-functions.R
+3c8f053562d8a077fee25583480445a5 *R/doByLabels-functions.R
+214a8e630acd4f5e45e606fafab73b96 *R/estimateBaseline-functions.R
+e67d4be8f27fcf43fca7513275e3a9f5 *R/estimateBaseline-methods.R
+6055f042660f476161cdb8e854481b79 *R/estimateNoise-functions.R
+0f0116bc5f9b1786c1c8945657972997 *R/estimateNoise-methods.R
+a1c393e07c57f5aa9c315892dff5b17a *R/filterPeaks-functions.R
+ccb3f1256630fb228be0dc4c90201a13 *R/findEmptyMassObjects-functions.R
+7add124838818d35706be89c71c7bd82 *R/findLocalMaxima-methods.R
+780b98d5dee572fffa309558d47052be *R/grouper-functions.R
+77405f89b1204a41dad7077f2822d137 *R/intensity-methods.R
+dde3d8e83c4dd3682e1e77e218fbac95 *R/intensityMatrix-functions.R
+c6c550a83793fc12cb31e804fda5411c *R/irregular-functions.R
+fcecced389c68ca66a4ec7798fc6b37a *R/isEmpty-methods.R
+52b9cbc2f3c347104276796c625cec6d *R/isFunctionList-functions.R
+2b8e50a9ca3ea5c5bcd19a43e4ef2b25 *R/isMassObject-functions.R
+b20c4de8370aec952a2ae40b415e518d *R/isMassObjectList-functions.R
+8fc917f8098f9e7cb9ef90da6d275597 *R/isRegular-methods.R
+16423d979461e0191b67480547cfc2d5 *R/isValidHalfWindowSize-functions.R
+d877612eae1f4598362fa7b4d42f370a *R/labelPeaks-methods.R
+5b44ce2729804ac92b2ee31edf61fd53 *R/lapply-functions.R
+a243c3067835676e8bca427899a8cbc2 *R/length-methods.R
+0f5de9d5429053f2c5a77e1445406879 *R/lines-methods.R
+6b1e674311aedcc25f4013ca51bdcef0 *R/localMaxima-functions.R
+a0e07d8d44716e64ccd88385a2a38194 *R/mapply-functions.R
+98c5b901d50427aa5e9827ebd01f8565 *R/mass-methods.R
+da7f87f2188be6fa3f15d0ffa7580bf7 *R/memoryUsage-functions.R
+b26719891ccca89256eed191511d6c26 *R/merge-functions.R
+070c6da6099aed3b4a3a99542114955d *R/metaData-methods.R
+f5b9f117f9744d133e0c884842f9265e *R/morphologicalFilter-functions.R
+0424a327afb90b3e7b750304eb4e2eae *R/msiSlices-functions.R
 fa547213b2834923c27940ef9a72259d *R/onAttach.R
-a2adfd93615e2f8a6561f3fa702dcbc1 *R/plot-methods.R
-cbeb782c189077feb1ac39954fee8be6 *R/plotImsSlice-functions.R
-7728dd2db0e907263e2b8175835e1548 *R/points-methods.R
-5f8fd6ab4cb5e682e13fc3047b46d7df *R/range-functions.R
-573b7d3a611c585f7ebddeec5bd8f9e5 *R/referencePeaks-functions.R
-245752ead063604eccb2f8a3b040a9e3 *R/removeBaseline-methods.R
-30c684b3c6d6f3e02016dff7281d5663 *R/removeEmptyMassObjects-functions.R
-200ccbfa5d302193ab284d52a8dfe523 *R/replaceNegativeIntensityValues-functions.R
-722bd6c3c1c95a1cf74a88e57a23ac5b *R/show-functions.R
-2f6c3bf983a071c2de154caa74cf4a0b *R/show-methods.R
-37eedd1fc72e28b324a50db663589a87 *R/smoothIntensity-methods.R
-9e1fb858c1c6392bc0be9b0ade55ae05 *R/smoothingFilters-functions.R
-27325b6557a06c3ed150139b36410b2f *R/snr-methods.R
-fbf45f4951c0f412157a3d765fc0f312 *R/subset-methods.R
-99aaf523caa5cd3e75ab8f538c03dad9 *R/textLabelRects-functions.R
-5c914fbd3a2dfe840acdf58341b9f171 *R/totalIonCurrent-methods.R
-41fbc52dc78b424397895ea6685d3ad2 *R/transformIntensity-methods.R
-1ec1871dee0025c04706382bec2c4899 *R/trim-methods.R
-61879b605350c6033da9b848478686c0 *R/unlist-functions.R
-159d530f9a14154ea407392c38f81648 *R/valid-methods.R
-d23b986e1b0c090e1986f124f3302d14 *R/warp-functions.R
-ce4cbe14f1870a32bbbbfcaa391cf765 *R/warpingFunction-functions.R
-b56be85ea700d1a8ca239bbb6a91f635 *R/which.closest-functions.R
-739968aeaaf32c31215e3ca610ded60a *build/vignette.rds
+2fcc7fc012be5bf9ecbc5527e037bc89 *R/plot-methods.R
+e13dc0db3259af85853190974635c729 *R/plotMsiSlice-functions.R
+83e73979f18e47e1be8e0f6586c3004c *R/plotMsiSlice-methods.R
+9db6da4dd742859f52e9bae39a8b500f *R/points-methods.R
+c95bede0b551a8cf3d4489b948faaf42 *R/range-functions.R
+d64b052a30fcce41ef4ca72e746403fc *R/referencePeaks-functions.R
+5aac42976b5ca56a4070fdb25e8cd5bd *R/removeBaseline-methods.R
+6797cb7ed992ef95ceed2977a2e435fb *R/removeEmptyMassObjects-functions.R
+0fd8dc6fdb45dcb1661f701834916be0 *R/replaceNegativeIntensityValues-functions.R
+98faf6e800741482c467d9d99fb84828 *R/show-functions.R
+9ca06ec5a700c5632ab6e07f56575bbb *R/show-methods.R
+211716efe7ca9cbd71297f025a44fa67 *R/smoothIntensity-methods.R
+1b82736fd8b283789cbf30c057782593 *R/smoothingFilters-functions.R
+44e9fc19f7b23f9d22c78b28d12506da *R/snr-methods.R
+89fd257befbb3449b1cd1e7dc97b9f06 *R/subset-methods.R
+9636ea5407fe75c5ffe842e2e7c29de3 *R/textLabelRects-functions.R
+738540612b0c5083d82edb9520f5eccb *R/totalIonCurrent-methods.R
+1d9db5fd5d9af6339f4ed44d078314d5 *R/transformIntensity-methods.R
+401341e89d9316a5f981d75e762c4d1b *R/trim-methods.R
+00f1d105005e6ec8007ceff929dbea5d *R/unlist-functions.R
+4fb6e7c34d59b143f77824298118428d *R/valid-methods.R
+e9046e0b8fd2d120f6241f79e3123d7c *R/warp-functions.R
+58d278b23f32e90d2cc46b8990c2e6f0 *R/warpingFunction-functions.R
+227e6c4644969b4f4235828ccca99a8b *R/which.closest-functions.R
+a44379172528f4e8f38f02c329182765 *build/vignette.rds
 325598b0f8bcbe241bf33882d83b6f85 *data/fiedler2009subset.RData
 b1d4b3db5f8a9d68fc4692e30026986e *demo/00Index
 cd6a6ad12205a639b80a67a1a5080723 *demo/MALDIquant.R
-4a08efdb52ad0c588b42dcae1d85ee0e *demo/baseline.R
+60f1b0632cab1b99c864a9e7c27bfa7c *demo/baseline.R
 9d4b1343695f6eb16b6fec4a8f1a4839 *demo/peaks.R
 c250741acaccf4baa0b0f9f3a2d8933f *demo/warping.R
 c9360cb1fb38da8fc547d5ad59422b5b *demo/workflow.R
 45e944c7928cff18a5275b4dc5ff1288 *inst/CITATION
 5bcd1c7abae66e68fe9dc628e5e7324b *inst/doc/MALDIquant-intro.R
 1e51473c26e4202ac6b4f6123caba9e1 *inst/doc/MALDIquant-intro.Rnw
-919cc9ed4c110dd4c27d29fa8e277c16 *inst/doc/MALDIquant-intro.pdf
-a5c69404f469be0bd7808c6a6785edf0 *man/AbstractMassObject-class.Rd
-2384c55f0b86a2e8a7742375e7b20c97 *man/MALDIquant-defunct.Rd
-dec195bfad53b84d0e1348b6e7114ab6 *man/MALDIquant-deprecated.Rd
-5072e6d92f07735028985ec6a6d467a5 *man/MALDIquant-package.Rd
+7d6a1b9d6c840e1ae3e959ef11f92e74 *inst/doc/MALDIquant-intro.pdf
+4c80960195de43ac4d36bc6cbf082bdd *man/AbstractMassObject-class.Rd
+c0e87985b2517f616d0e654f6a1af3f8 *man/MALDIquant-defunct.Rd
+70b8a231de7ee5fdce63c45ffc68e31c *man/MALDIquant-deprecated.Rd
+0344a4b76f340ef0a28a354de83fff24 *man/MALDIquant-package.Rd
+80bd218ebf5f8fece5ae9d2bd775cffd *man/MALDIquant-parallel.Rd
 0e055042e38b63ed5f8e03c75eb7e2c7 *man/MassPeaks-class.Rd
 ad08ffc779a2cb1a3b644414b580ad60 *man/MassSpectrum-class.Rd
-9e6c4b9a6d2a064a80dab68c01e53b4e *man/alignSpectra-functions.Rd
-b87732f847957b41854f822f173ddf75 *man/averageMassSpectra-functions.Rd
+e875a796b1336bef16dd3cfa3d355e82 *man/alignSpectra-functions.Rd
+259ee82b6bdbc8c970dce986b46e5ba3 *man/averageMassSpectra-functions.Rd
 9b63d08ba73dcb287c3e066140e98fc6 *man/binPeaks-functions.Rd
-6bdd68d090e77f338c150f64c5305a2a *man/calibrateIntensity-methods.Rd
-69072679c23ff28641931f6f86dddb52 *man/createMassPeaks-functions.Rd
+ccae661190925ed42589c8a60e1cc9da *man/calibrateIntensity-methods.Rd
+2259c40412e5551c81654007eae4c7a8 *man/createMassPeaks-functions.Rd
 30c86bc22623778724e87f2367a98205 *man/createMassSpectrum-functions.Rd
-cc1866bf939ea4ab68a58c728239b850 *man/detectPeaks-methods.Rd
+fa021d2215691899b7f441a35cdcfad3 *man/detectPeaks-methods.Rd
 2809c9abb81930d89ee6785480be0aea *man/determineWarpingFunctions-functions.Rd
 c9fe76643210d63c330234777cfa027e *man/estimateBaseline-methods.Rd
 ba15ac52b921d707033bfdfb6eb5c641 *man/estimateNoise-methods.Rd
 e0ba47d418a460fe74d3cb5075bf9466 *man/fiedler2009subset.Rd
 96176739bda274f169e7ba912ed5f4e7 *man/filterPeaks-functions.Rd
 f82c0d14f1d7a8cada86047e1f0c172a *man/findEmptyMassObjects-functions.Rd
-f31570cdc5df5a721d535678734b91e0 *man/intensityMatrix-functions.Rd
+dd2a0fb36bb864a09b79a294e5f1f1d5 *man/intensityMatrix-functions.Rd
 a0ad3cf98d26953dd93aa84eb4bf8298 *man/isMassObject-functions.Rd
 c11136206258d7b34948bca285f7e927 *man/isMassObjectList-functions.Rd
 58d8b213280ef916e8f1956034918ec6 *man/labelPeaks-methods.Rd
-1fb31f987f3d4a1b39425259e971d662 *man/mergeMassPeaks-functions.Rd
+fa8b97f3c7c798f0d54959c5a291ec51 *man/mergeMassPeaks-functions.Rd
+f71932d026a6053597b707a0463ae833 *man/msiSlices-functions.Rd
 127b101c355f5695531f3baf058adfe9 *man/plot-methods.Rd
-3031d6500b95d01fd2110ecccb9d2f9e *man/plotImsSlice-functions.Rd
+3355021c9ac7ae7709266ad37e16841b *man/plotMsiSlice-methods.Rd
 7a2c17178b10d9c4da8ed91a8e02e412 *man/referencePeaks-functions.Rd
-df4c229652db2c917647e02faf33f8f8 *man/removeBaseline-methods.Rd
+9ca8f5f6f2b094a3258a64ec9ac50a5b *man/removeBaseline-methods.Rd
 1a265fd746eddd3bb6d6427fea26baa0 *man/smoothIntensity-methods.Rd
-0d4d7a004bdd7fa3df82c94e586c91fc *man/transformIntensity-methods.Rd
-b61504c144cb9f3b4610cb6a561420bf *man/trim-methods.Rd
+f18ff018fa638fbffc409ac7ccafab02 *man/transformIntensity-methods.Rd
+b12baddadb4bd9328b51dfecf268a8e8 *man/trim-methods.Rd
 3335acf9348d90477fd2e6bcbdefad27 *man/warp-functions.Rd
 38415d834917f303276bbfc4ae7af2c6 *src/MALDIquant.h
 60981e9053676a37966435e95997ab2b *src/colMedians.c
-9d8576241a46e84acc556ccc59312276 *src/init.c
-cba6341e3fdbd1473fe19a992bff7b83 *src/localMaxima.c
-799aabe8a7dc75123a0e9e958812c93b *src/lowerConvexHull.c
-4f18e4c44f85c307d03c64d2dbdd1b98 *src/morphologicalFilters.c
-d584865ba73e0280e156279f76a77d25 *src/snip.c
+72d97a74c07cead73cba6e9f6f105d9c *src/init.c
+84bbe5fae4c01cf58bf6849828eb1775 *src/localMaxima.c
+d7dc99ca5017916b68b3a71a37927789 *src/lowerConvexHull.c
+6fad5941d2d7d8188cc07e2ae7391583 *src/morphologicalFilters.c
+5ea261ad15a1cc2d9bdbbbceff8c6ee6 *src/snip.c
 912144481b4c12b9881702c42f4ad11a *tests/testthat.R
-932fef0296403876c254af44d1111c54 *tests/testthat/test_approxfun-methods.R
-16a99e421049f72f5f55027f63eea2c4 *tests/testthat/test_as.matrix-functions.R
+87882b2cc3fda7dd9b40f260ad9aa433 *tests/testthat/test_approxfun-methods.R
+877e22ad7ab1e8fc76de37ff7eb83a71 *tests/testthat/test_as-methods.R
+4c7a8f1a097beaff01c1d863497119b1 *tests/testthat/test_as.matrix-functions.R
 6190f4bc3eba28a0bc2a1deef66ad37f *tests/testthat/test_as.matrix-methods.R
-d320c9127a2f11b8d04d4cc9283c1bb5 *tests/testthat/test_averageMassSpectra-functions.R
+f0c6d6810ac4af4e7e14af64ff0c0c90 *tests/testthat/test_averageMassSpectra-functions.R
 d513f8c0a0167cf60386efcafd6138e1 *tests/testthat/test_binPeaks-functions.R
-7f59bd9a93b716d2f70b41fa8cd670d0 *tests/testthat/test_calibrateIntensity-methods.R
-6ab3507a99d7bdc1f8dde8b85ca42857 *tests/testthat/test_colMedians-functions.R
+f8a3288eb16dfb592934d455bab7109f *tests/testthat/test_calibrateIntensity-methods.R
+a9e4bcf5f5d62a70f6d6b31d8c0bcec8 *tests/testthat/test_colMedians-functions.R
 d43f596aaaf41ff670bd1c8f5375c6ba *tests/testthat/test_constructor-functions.R
-7cd10c04b2aaa60229562441172e8c09 *tests/testthat/test_deprecated-functons.R
-b94b7d40be1a2c85171fa5b73447d73f *tests/testthat/test_detectPeaks-methods.R
-5c088a86280ef99c885685babcc7ab18 *tests/testthat/test_determineWarpingFunctions-functions.R
-34a9dae5130a2fd94ddbd5b436559d65 *tests/testthat/test_doByLabel-functions.R
-4b01a48c362bd286853e9c46c6ab1652 *tests/testthat/test_estimateBaseline-methods.R
-e310a5998e9e3706a82348ac9e4d1841 *tests/testthat/test_estimateNoise-methods.R
+2c1d1c6d623cfbb9206bb98ed3cdca0e *tests/testthat/test_coordinates-methods.R
+4697bcf0bf73a2b7df6b756217c18098 *tests/testthat/test_deprecated-functons.R
+255d018afbadf2a359bf0bbcfb940426 *tests/testthat/test_detectPeaks-methods.R
+b2933a14afa08b8f8d9b715c6a964866 *tests/testthat/test_determineWarpingFunctions-functions.R
+7f7afb275f167ad815b6452ccf96ffc3 *tests/testthat/test_doByLabel-functions.R
+e199e579e823e1c6948c4cbd1b1b4901 *tests/testthat/test_estimateBaseline-methods.R
+0f42dd3217c3f6f4bfba6fc4841809ea *tests/testthat/test_estimateNoise-methods.R
 01f20533d0cf0f2df4d95acf46d57be4 *tests/testthat/test_filterPeaks-functions.R
-37ce987d248c073119231c0d94098112 *tests/testthat/test_findEmptyMassObjects-functions.R
+02c1acf4643d208a4798a5f92881ce7e *tests/testthat/test_findEmptyMassObjects-functions.R
 f6ab8ca435902df81a693a91a1787173 *tests/testthat/test_findLocalMaximaLogical-methods.R
 54edc8be527b360fe1f0bdc839666f52 *tests/testthat/test_grouper-functions.R
 4249736cf2705a5d7262520fcce5fd0f *tests/testthat/test_intensity-methods.R
-2aa015214ef211ea444d7556009e270b *tests/testthat/test_intensityMatrix-functions.R
-4280b30f805619983542ef41fe0ddaf4 *tests/testthat/test_irregular-functions.R
-aa13cd831e9082ec01d0fa6669112a8f *tests/testthat/test_isEmpty-methods.R
+c1999a203e4ce53469198a8df9cfb27f *tests/testthat/test_intensityMatrix-functions.R
+e7e4ca7db4bbb320585c96ffb101d616 *tests/testthat/test_irregular-functions.R
+f5fd81bf06eb29a1dcc9d197df725f4f *tests/testthat/test_isEmpty-methods.R
 039cbd41e8a2db1ab24ffa2041fc80cf *tests/testthat/test_isMassObject-functions.R
 9edba7830c5c0804514173de766e0278 *tests/testthat/test_isMassObjectList-functions.R
-1463d5d936a582a0e41298237df175df *tests/testthat/test_isRegular-methods.R
-b7b96289ddcac4ebdd7b0d9031c80516 *tests/testthat/test_length-methods.R
-8b4183165aabf58d0f746ac9f0943173 *tests/testthat/test_localMaxima-functions.R
-3e700401011b7fa7d84d83d551fa67d5 *tests/testthat/test_mapply-functions.R
-253f03d93fd5144e4f187c1aef111adb *tests/testthat/test_mass-methods.R
-9a42fa3bdd4ed63c9ea5567d98944ff3 *tests/testthat/test_merge-functions.R
-49b8024fbe1066b5c68c2d079f5aba87 *tests/testthat/test_metaData-methods.R
-daf9c7d9f789cc928d0992769f6cefde *tests/testthat/test_morphologicalFilter-functions.R
-f3fe9d288ee8367c256c90525abf3715 *tests/testthat/test_range-functions.R
-0af5408a284ab5a166f06973f1996b05 *tests/testthat/test_referencePeaks-functions.R
-689a72a9a7ab394f532d22f14010c291 *tests/testthat/test_removeBaseline-methods.R
-813815527b6e591b215e065e7422dad0 *tests/testthat/test_removeEmptyMassObjects-functions.R
+bd05f7675f25fa54a905c23935ed5297 *tests/testthat/test_isRegular-methods.R
+d3da7be2d02d75e4d71d8e78690b4815 *tests/testthat/test_length-methods.R
+73ddd27b5828b3527b180fbd996e5da8 *tests/testthat/test_localMaxima-functions.R
+9bd02e48066c5b7fcdf2c0d2a2d037b9 *tests/testthat/test_mapply-functions.R
+7af4eff6b2653619b6d0207e4b632bb5 *tests/testthat/test_mass-methods.R
+316f6eec9709cd9af17af7663017b612 *tests/testthat/test_merge-functions.R
+2482b2ef93732be18165854c43e5a465 *tests/testthat/test_metaData-methods.R
+410f5be8602e350599b72e43d8dbe06c *tests/testthat/test_morphologicalFilter-functions.R
+50aeb369a16cfc3fc163b7809dc5dd41 *tests/testthat/test_msiSlices-functions.R
+e9ef4890c1d04fe539a09be67c970100 *tests/testthat/test_plotMsiSlice-functions.R
+6556b3d36feecc3ea4d6c32838524364 *tests/testthat/test_range-functions.R
+06e01c3d7fd0446c22a64f367e378458 *tests/testthat/test_referencePeaks-functions.R
+114d273f2812fd16b59a89c588d3aec8 *tests/testthat/test_removeBaseline-methods.R
+5538905e86196d2f85f456f1e276dd15 *tests/testthat/test_removeEmptyMassObjects-functions.R
 399cb71acb1570fcdc4d42104f3de431 *tests/testthat/test_replaceNegativeIntensityValues.R
-438abeff349258bef816b030b88c3973 *tests/testthat/test_show-methods.R
-18638ca5fa1de8193606c2ba8bbdc26a *tests/testthat/test_smoothIntensity-methods.R
-69ea5740165c32cc7cf9234bd9281f5d *tests/testthat/test_smoothingFilters-functions.R
-52e2e182222dc5453228cee39eeaa080 *tests/testthat/test_snr-methods.R
-2c71f06b573ac902c3116f1525a152d2 *tests/testthat/test_subset-methods.R
-f4165a0b842c0d27088905a2112936fe *tests/testthat/test_totalIonCurrent-methods.R
-889d6c146789933c18d4f4ab9d011308 *tests/testthat/test_transformIntensity-methods.R
-15c9290850d46f88abd30e8de3d0c449 *tests/testthat/test_trim-methods.R
-189b492b9effdf126522989fbc96f885 *tests/testthat/test_unlist-functions.R
-ae8363f7a15c7b4a1c4eaa7fd3faf3b7 *tests/testthat/test_warp-functions.R
-b9b096e283b034935a4592a2e8ca31eb *tests/testthat/test_warpingFunctions-functions.R
-628aab1ffb1146aec4c2ef89812e9174 *tests/testthat/test_which.closest-functions.R
+494cf7199210056664cec5ed98ce6c5f *tests/testthat/test_show-methods.R
+cabcb37aaa9ac7b8529e042a97e8d6a9 *tests/testthat/test_smoothIntensity-methods.R
+8263dfa7e0052cc419ab3f1421b7c9fe *tests/testthat/test_smoothingFilters-functions.R
+07d474fe08b42562cbc63ed383c48e8f *tests/testthat/test_snr-methods.R
+baba5299f469d4cfc0b02f88031d5d95 *tests/testthat/test_subset-methods.R
+63a2139834341232083d42588ef952f4 *tests/testthat/test_totalIonCurrent-methods.R
+583fe1a5e4c00b90f776712dcc30b1af *tests/testthat/test_transformIntensity-methods.R
+a882627bdaaebfe7b2af7a6c6e9216fe *tests/testthat/test_trim-methods.R
+2b8c608f99e0bd7f9165af86bbc15dfb *tests/testthat/test_unlist-functions.R
+dddf909a829f0dfb666640f14d6643a4 *tests/testthat/test_valid-functions.R
+f37f1714a6d4b6cf38956c3cfa44d1b3 *tests/testthat/test_warp-functions.R
+e9fcbba719208af5463784ad2ca27699 *tests/testthat/test_warpingFunctions-functions.R
+ed5298fbc4fdf08046cdab7778475994 *tests/testthat/test_which.closest-functions.R
 1e51473c26e4202ac6b4f6123caba9e1 *vignettes/MALDIquant-intro.Rnw
-5edaa50005ab2be6fc5d907017773026 *vignettes/bibliography.bib
+5c072541fc956025aecacd9dc2129c6a *vignettes/bibliography.bib
diff --git a/NAMESPACE b/NAMESPACE
index a57b815..31d6419 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,5 +1,9 @@
 import("methods")
 
+importFrom("parallel",
+              "mclapply",
+              "mcmapply")
+
 importFrom("graphics",
               "lines",
               "plot",
@@ -31,6 +35,7 @@ export("alignSpectra",
        "isMassSpectrum",
        "isMassSpectrumList",
        "mergeMassPeaks",
+       "msiSlices",
        "plotImsSlice",
        "referencePeaks",
        "removeEmptyMassObjects",
@@ -39,6 +44,8 @@ export("alignSpectra",
 
 exportMethods("as.matrix",
               "calibrateIntensity",
+              "coordinates",
+              "coordinates<-",
               "detectPeaks",
               "estimateBaseline",
               "estimateNoise",
@@ -54,6 +61,7 @@ exportMethods("as.matrix",
               "metaData",
               "metaData<-",
               "plot",
+              "plotMsiSlice",
               "points",
               "removeBaseline",
               "smoothIntensity",
diff --git a/NEWS b/NEWS
index cfe62b8..0360cff 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,60 @@ RELEASE HISTORY OF THE "MALDIquant" PACKAGE
 ===========================================
 
 
+CHANGES IN MALDIquant VERSION 1.12 [2015-06-11]:
+------------------------------------------------
+
+NEW FEATURES
+
+* Add `as` for MassPeaks to convert them into MassSpectrum objects.
+* Add `coordinates` methods for AbstractMassObjects and list objects to
+  access/set coordinates for MSI datasets.
+* `calibratyIntensity(object, method="TIC")`: gains a "range" argument allowing
+  to calibrate spectra by TIC on a specific mass range; closes #27.
+* Add parallel support on unix-based platforms using the parallel package. The
+  following functions/methods supports the "mc.cores" argument (default is 1):
+  `trim`, `transformIntensity`, `removeBaseline`, `calibrateIntensity`,
+  `detectPeaks`, `alignSpectra`, `averageMassSpectra`, `mergeMassPeaks`;
+  Please read also `?"MALDIquant-parallel"`.
+
+IMPROVEMENTS
+
+* `intensityMatrix`: rewrite to improve execution time.
+* `trim`: rewrite to improve execution time.
+
+MODIFICATIONS
+
+* Change generics of `mass` and `intensity` from `function(object)` to
+  `function(object, ...)` to provide the same generics as Bioconductor's
+  ProtGenerics package.
+* `intensityMatrix`: gains an attribute "mass" that stores the unique mass.
+
+DEPRECATED ARGUMENTS/FUNCTIONS
+
+* `plotImsSlice`: use `plotMsiSlice` instead. It has slightly different
+  arguments; see `?plotMsiSlice` for details.
+
+REMOVED ARGUMENTS/FUNCTIONS
+
+* `intensityMatrix` for MassSpectrum objects (was defunct since 1.10).
+
+BUGFIXES
+
+* Fix vignette call in `?MALDIquant-package`.
+
+INTERNAL CHANGES
+
+* The return value of the internal `.as.matrix.MassObjectList` function gains an
+  attribute "mass" that stores the unique mass (conversions of the colnames are
+  not needed anymore);
+  affected functions: `intensityMatrix`
+* Remove some useless `cbind` calls in `.estimateNoise*` and
+  `.estimateBaseline`; no user visible changes;
+  affected functions: `estimateNoise`, `estimateBaseline`, `detectPeaks`
+* Remove superfluous arguments in internal `.calibrateIntensitySimple`.
+* Avoid double check for negative intensity values in `transformIntensity`.
+
+
 CHANGES IN MALDIquant VERSION 1.11 [2014-08-11]:
 ------------------------------------------------
 
@@ -73,7 +127,7 @@ REMOVED ARGUMENTS/FUNCTIONS
 * `removeBaseline`, argument "fun": use "method" argument instead.
 * `detectPeaks`, argument "fun": use "method" argument instead.
 
-BUG FIXES
+BUGFIXES
 
 * `.which.closest`: check limits to avoid missing matches in some
   rare edge cases;
@@ -242,7 +296,7 @@ REMOVED FUNCTIONS
   nasty bugs, e.g.: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15208
   Also the "zoom" R package provides similar functionality.
 
-BUG FIXES
+BUGFIXES
 
 * `totalIonCurrent`: fix calculation by estimating the integral; fixes #29.
   affected functions: `totalIonCurrent`,
@@ -290,7 +344,7 @@ IMPROVEMENTS
 * `movingAverage`: left/right extrema now calculated for 0:windowSize and
   (n-windowSize+1):n (before they were set to NA).
 
-BUG FIXES
+BUGFIXES
 
 * `filterPeaks`: doesn't round (floor) minFrequency argument anymore; led to
   unexpected results; fixes #22.
@@ -325,7 +379,7 @@ IMPROVEMENTS
 
 * Include tests in inst/tests.
 
-BUG FIXES
+BUGFIXES
 
 * `.which.closest`: rounding .5 to the next highest integer (before: to the next
   lowest one); affected functions: `labelPeaks`.
@@ -399,7 +453,7 @@ MODIFICATIONS
 * `labelPeaks`: change default value for verticalOffset argument.
 * `labelPeaks`: remove family argument.
 
-BUG FIXES
+BUGFIXES
 
 * Fix `isMassSpectrumList`.
 
@@ -527,7 +581,7 @@ MODIFICATIONS
 * Move importing functions to the following R-packages: readBrukerFlexData,
   readMzXmlData.
 
-BUG FIXES
+BUGFIXES
 
 * change `.C(..., DUP=F)` to `.C(..., DUP=T)` in `.estimateBaselineSnip`
   to avoid changes of global variables.
@@ -549,4 +603,3 @@ CHANGES IN MALDIquant VERSION 0.1 [2011-02-22]:
 
 * First public release.
 * Up to now only importing and plotting of a single mass spectrum are supported.
-
diff --git a/R/AllClasses.R b/R/AllClasses.R
index 3d2cf55..0515150 100644
--- a/R/AllClasses.R
+++ b/R/AllClasses.R
@@ -33,4 +33,3 @@ setClass("MassPeaks",
          slots=list(snr="numeric"),
          prototype=list(snr=numeric()),
          contains="AbstractMassObject")
-
diff --git a/R/AllGenerics.R b/R/AllGenerics.R
index 091d566..f08a89f 100644
--- a/R/AllGenerics.R
+++ b/R/AllGenerics.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2013 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -29,6 +29,9 @@ if (is.null(getGeneric("lines"))) {
 if (is.null(getGeneric("plot"))) {
   setGeneric("plot", function(x, y, ...) standardGeneric("plot"))
 }
+if (is.null(getGeneric("plotMsiSlice"))) {
+  setGeneric("plotMsiSlice", function(x, ...) standardGeneric("plotMsiSlice"))
+}
 if (is.null(getGeneric("points"))) {
   setGeneric("points", function(x, ...) standardGeneric("points"))
 }
@@ -37,28 +40,25 @@ if (is.null(getGeneric(".prepareShow"))) {
 }
 if (is.null(getGeneric("transformIntensity"))) {
   setGeneric("transformIntensity",
-             function(object, ...)
-               standardGeneric("transformIntensity"))
+             function(object, ...) standardGeneric("transformIntensity"))
 }
 if (is.null(getGeneric(".transformIntensity"))) {
   setGeneric(".transformIntensity",
-             function(object, ...)
-               standardGeneric(".transformIntensity"))
+             function(object, ...) standardGeneric(".transformIntensity"))
 }
 if (is.null(getGeneric("trim"))) {
-  setGeneric("trim",
-             function(object, range) standardGeneric("trim"))
+  setGeneric("trim", function(object, range, ...) standardGeneric("trim"))
 }
 
 ## get/set slots
 if (is.null(getGeneric("mass"))) {
-  setGeneric("mass", function(object) standardGeneric("mass"))
+  setGeneric("mass", function(object, ...) standardGeneric("mass"))
 }
 if (is.null(getGeneric("mass<-"))) {
   setGeneric("mass<-", function(object, value) standardGeneric("mass<-"))
 }
 if (is.null(getGeneric("intensity"))) {
-  setGeneric("intensity", function(object) standardGeneric("intensity"))
+  setGeneric("intensity", function(object, ...) standardGeneric("intensity"))
 }
 if (is.null(getGeneric("intensity<-"))) {
   setGeneric("intensity<-",
@@ -77,6 +77,15 @@ if (is.null(getGeneric("metaData<-"))) {
   setGeneric("metaData<-",
              function(object, value) standardGeneric("metaData<-"))
 }
+if (is.null(getGeneric("coordinates"))) {
+  setGeneric("coordinates",
+             function(object, ...) standardGeneric("coordinates"))
+}
+if (is.null(getGeneric("coordinates<-"))) {
+  setGeneric("coordinates<-",
+             function(object, value) standardGeneric("coordinates<-"))
+}
+
 ## end of AbstractMassObject
 
 ## MassSpectrum
@@ -136,7 +145,7 @@ if (is.null(getGeneric("totalIonCurrent"))) {
 if (is.null(getGeneric("labelPeaks"))) {
   setGeneric("labelPeaks",
              function(object, index, mass, labels, digits=3L, underline=TRUE,
-                      verticalOffset=abs(diff(par("usr")[3:4]))*0.0125,
+                      verticalOffset=abs(diff(par("usr")[3:4])) * 0.0125,
                       absoluteVerticalPos, adj=c(0.5, 0L), cex=0.7,
                       avoidOverlap=FALSE, arrowLength=0L, arrowLwd=0.5,
                       arrowCol=1, ...) standardGeneric("labelPeaks"))
@@ -157,4 +166,3 @@ if (is.null(getGeneric(".labelOverlap"))) {
              function(object, ...) standardGeneric(".labelOverlap"))
 }
 ## end of MassPeaks
-
diff --git a/R/Deprecated.R b/R/Deprecated.R
index c6d0b9f..5f7dfae 100644
--- a/R/Deprecated.R
+++ b/R/Deprecated.R
@@ -1,16 +1,66 @@
-## deprecated since MALDIquant 1.8.4
-## intensityMatrix for MassSpectrum objects
-## TODO: remove corresponding code in intensityMatrix
-.intensityMatrixDeprecated <- function(l) {
-  mass <- sort(x=.unlist(lapply(l, function(x)x at mass)), method="quick")
-  uniqueMass <- unique(mass)
+## deprecated since MALDIquant 1.11.12
+plotImsSlice <- function(x, range=c(0, Inf),
+                         sub=paste0("m/z: ", range[1L], "-", range[2L], ""),
+                         removeEmptyRows=TRUE,
+                         removeEmptyCols=TRUE,
+                         colRamp=colorRamp(c("black", "blue", "green",
+                                             "yellow", "red")),
+                         interpolate=FALSE, ...) {
+  .deprecatedFunction("1.11.12", new="plotMsiSlice")
 
-  ## build matrix
-  m <- do.call(rbind, lapply(l, function(x) {
-    return(x at intensity[match(x=uniqueMass, table=x at mass, nomatch=NA)])}))
+  .prepareImsSlice <- function(x, range) {
 
-  ## set column names
-  dimnames(m) <- list(NULL, c(uniqueMass))
+    .stopIfNotIsMassObjectList(x)
 
-  return(m)
+    ## display only mass in range
+    suppressWarnings(x <- trim(x, range=range))
+
+    ## find x and y positions
+    pos <- lapply(x, function(y)metaData(y)$imaging$pos)
+    pos <- do.call(rbind, pos)
+
+    if (is.null(pos)) {
+      stop("The spectra do not have any position information.")
+    }
+
+    ## max x/y to build image matrix
+    nc <- max(pos[, "x"])
+    nr <- max(pos[, "y"])
+
+    ## init matrix
+    m <- matrix(NA, nrow=nr, ncol=nc)
+
+    ## fill matrix with intensity values
+    for (i in seq(along=x)) {
+      m[pos[i, "y"], pos[i, "x"]] <- sum(intensity(x[[i]]), na.rm=TRUE)
+    }
+
+    ## scale matrix (better contrast)
+    m/max(m, na.rm=TRUE)
+  }
+
+  m <- .prepareImsSlice(x = x, range = range)
+
+  if (removeEmptyRows) {
+    kr <- rowSums(is.na(m)) != ncol(m)
+    m <- m[kr, , drop=FALSE]
+  }
+  if (removeEmptyCols) {
+    kc <- colSums(is.na(m)) != nrow(m)
+    m <- m[, kc, drop=FALSE]
+  }
+
+  nr <- nrow(m)
+  nc <- ncol(m)
+
+  ## create color raster
+  isNotNA <- which(!is.na(m))
+  m[isNotNA] <- rgb(colRamp(m[isNotNA]), maxColorValue=255L)
+
+  ## prepare plot area
+  plot(NA, type="n", xlim=c(1L, nc), ylim=c(1L, nr), axes=FALSE, asp=1L,
+       xlab="", ylab="", sub=sub, ...)
+  ## plot image
+  rasterImage(as.raster(m), xleft=1L, xright=nc, ybottom=1L, ytop=nr,
+              interpolate=interpolate)
 }
diff --git a/R/alignSpectra-functions.R b/R/alignSpectra-functions.R
index 0b2bb2b..e70be1c 100644
--- a/R/alignSpectra-functions.R
+++ b/R/alignSpectra-functions.R
@@ -37,14 +37,15 @@ alignSpectra <- function(spectra,
                          ## peak detection
                          halfWindowSize=20, noiseMethod="MAD", SNR=2,
                          ## warping
-                         reference, tolerance=0.002, warpingMethod="lowess") {
+                         reference, tolerance=0.002, warpingMethod="lowess",
+                         ...) {
 
   ## test arguments
   .stopIfNotIsMassSpectrumList(spectra)
 
   peaks <- detectPeaks(spectra, halfWindowSize=halfWindowSize,
-                       method=noiseMethod, SNR=SNR)
+                       method=noiseMethod, SNR=SNR, ...)
   wf <- determineWarpingFunctions(peaks, reference=reference,
                                   tolerance=tolerance, method=warpingMethod)
-  return(warpMassSpectra(spectra, wf))
+  warpMassSpectra(spectra, wf)
 }
diff --git a/R/approxfun-methods.R b/R/approxfun-methods.R
index 5064e62..aca03ad 100644
--- a/R/approxfun-methods.R
+++ b/R/approxfun-methods.R
@@ -22,10 +22,9 @@ setMethod(f="approxfun",
           definition=function(x, y=NULL, method="linear", yleft, yright,
                               rule=1L,  f=0L, ties=mean) {
   if (isEmpty(x)) {
-    return(function(x) { return(rep(NA, length.out=length(x))) })
+    function(x)rep.int(NA, length(x))
   } else {
-    return(approxfun(x=x at mass, y=x at intensity, method=method, yleft=yleft,
-                     yright=yright, rule=rule, f=f, ties=ties))
+    approxfun(x=x at mass, y=x at intensity, method=method,
+              yleft=yleft, yright=yright, rule=rule, f=f, ties=ties)
   }
 })
-
diff --git a/R/irregular-functions.R b/R/as-methods.R
similarity index 69%
copy from R/irregular-functions.R
copy to R/as-methods.R
index 7544247..5eb0c39 100644
--- a/R/irregular-functions.R
+++ b/R/as-methods.R
@@ -1,4 +1,4 @@
-## Copyright 2013 Sebastian Gibb
+## Copyright 2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -16,19 +16,12 @@
 ## You should have received a copy of the GNU General Public License
 ## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
 
-## .irregularScore
-##  calculate frequency of irregular data
-##
-## params:
-##  x: double
+## convert MassPeaks into MassSpectrum objects
 ##
 ## returns:
-##  double, frequency of irregular data
-##
-.irregularScore <- function(x) {
-  d <- diff(x)
-  d <- d[-1L] < head(d, -1L)
-
-  return(mean(d))
-}
+##  a MassSpectrum object
 
+setAs(from="MassPeaks", to="MassSpectrum",
+      function (from)createMassSpectrum(mass=from at mass,
+                                        intensity=from at intensity,
+                                        metaData=from at metaData))
diff --git a/R/as.matrix-functions.R b/R/as.matrix-functions.R
index 58d0cb4..fda14c3 100644
--- a/R/as.matrix-functions.R
+++ b/R/as.matrix-functions.R
@@ -28,17 +28,19 @@
 .as.matrix.MassObjectList <- function(l) {
   .stopIfNotIsMassObjectList(l)
 
-  mass <- sort(x=.unlist(lapply(l, function(x)x at mass)), method="quick")
-  uniqueMass <- unique(mass)
+  mass <- .unlist(lapply(l, function(x)x at mass))
+  intensity <- .unlist(lapply(l, function(x)x at intensity))
+  uniqueMass <- sort.int(unique(mass), method="quick")
+  n <- vapply(l, length, double(1L))
+  r <- rep.int(seq_along(l), n)
 
-  ## build matrix
-  m <- do.call(rbind, lapply(l, function(x) {
-    return(x at intensity[match(x=uniqueMass, table=x at mass, nomatch=NA)])}))
+  i <- findInterval(mass, uniqueMass)
 
-  ## set column names
-  dimnames(m) <- list(NULL, c(uniqueMass))
-
-  return(m)
+  m <- matrix(NA_integer_, nrow=length(l), ncol=length(uniqueMass),
+              dimnames=list(NULL, uniqueMass))
+  m[cbind(r, i)] <- intensity
+  attr(m, "mass") <- uniqueMass
+  m
 }
 
 ## .as.binary.matrix
@@ -54,6 +56,5 @@
   isNA <- which(is.na(m))
   m[] <- 1L
   m[isNA] <- 0L
-  return(m)
+  m
 }
-
diff --git a/R/as.matrix-methods.R b/R/as.matrix-methods.R
index e27239e..65be57a 100644
--- a/R/as.matrix-methods.R
+++ b/R/as.matrix-methods.R
@@ -21,7 +21,6 @@ setMethod(f="as.matrix",
           signature=signature(x="AbstractMassObject"),
           definition=function(x, index) {
 
-  return(matrix(c(x at mass[index], x at intensity[index]), ncol=2L, byrow=FALSE,
-                dimnames=list(NULL, c("mass", "intensity"))))
+  matrix(c(x at mass[index], x at intensity[index]), ncol=2L, byrow=FALSE,
+         dimnames=list(NULL, c("mass", "intensity")))
 })
-
diff --git a/R/averageMassSpectra-functions.R b/R/averageMassSpectra-functions.R
index 6e9f113..3238539 100644
--- a/R/averageMassSpectra-functions.R
+++ b/R/averageMassSpectra-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2013 Sebastian Gibb
+## Copyright 2013-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -27,7 +27,8 @@
 ## returns:
 ##  a new MassSpectrum object or a list of new MassSpectra objects
 ##
-averageMassSpectra <- function(l, labels, method=c("mean", "median", "sum")) {
+averageMassSpectra <- function(l, labels, method=c("mean", "median", "sum"),
+                               ...) {
 
   ## test parameters
   .stopIfNotIsMassSpectrumList(l)
@@ -43,13 +44,10 @@ averageMassSpectra <- function(l, labels, method=c("mean", "median", "sum")) {
               },
               "sum" = {
                 colSums
-              },
-              {
-                stop("Unknown ", sQuote("method"), ".")
               }
   )
 
-  return(.doByLabels(l=l, labels=labels, FUN=.averageMassSpectra, fun=fun))
+  .doByLabels(l=l, labels=labels, FUN=.averageMassSpectra, fun=fun, ...)
 }
 
 ## .averageMassSpectra
@@ -100,6 +98,5 @@ averageMassSpectra <- function(l, labels, method=c("mean", "median", "sum")) {
     mass <- double()
   }
 
-  return(createMassSpectrum(mass=mass, intensity=intensity, metaData=metaData))
+  createMassSpectrum(mass=mass, intensity=intensity, metaData=metaData)
 }
-
diff --git a/R/binPeaks-functions.R b/R/binPeaks-functions.R
index 4340d8b..16f5144 100644
--- a/R/binPeaks-functions.R
+++ b/R/binPeaks-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2012-2014 Sebastian Gibb
+## Copyright 2012-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -48,12 +48,10 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
   snr <- .unlist(lapply(l, function(x)x at snr))
 
   ## store original mass sample number/id
-  samples <- .unlist(lapply(1L:length(l), function(x) {
-    return(rep(x, length(l[[x]])))
-  }))
+  samples <- rep.int(seq_along(l), .unlist(lapply(l, length)))
 
   ## sort values by mass
-  s <- sort(mass, method="quick", index.return=TRUE)
+  s <- sort.int(mass, method="quick", index.return=TRUE)
 
   mass <- s$x
   intensities <- intensities[s$ix]
@@ -67,9 +65,6 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
             },
             "relaxed" = {
               .grouperRelaxed
-            },
-            {
-              stop("Unknown ", sQuote("method"), ".")
             }
   )
 
@@ -79,7 +74,7 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
 
   ## resort mass (order could change if "relaxed" is used)
   if (method == "relaxed") {
-    s <- sort(mass, method="quick", index.return=TRUE)
+    s <- sort.int(mass, method="quick", index.return=TRUE)
     mass <- s$x
     intensities <- intensities[s$ix]
     snr <- snr[s$ix]
@@ -87,19 +82,17 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
   }
 
   ## group mass/intensities/snr by sample ids
-  lIdx <- tapply(X=1L:length(mass), INDEX=samples, FUN=function(x) {
-    return(x)
-  })
+  lIdx <- split(seq_along(mass), samples)
 
   ## create adjusted peak list
   l <- .mapply(FUN=function(p, i) {
     p at mass <- mass[i]
     p at intensity <- intensities[i]
     p at snr <- snr[i]
-    return(p)
+    p
   }, p=l, i=lIdx)
 
-  return(l)
+  l
 }
 
 ## .binPeaks
@@ -133,7 +126,7 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
   ## it is a lot of faster than recursion
 
   ## store boundaries in a stack
-  nBoundaries <- max(20L, floor(3L*log(n)))
+  nBoundaries <- max(20L, floor(3L * log(n)))
   boundary <- list(left=double(nBoundaries), right=double(nBoundaries))
 
   currentBoundary <- 1L
@@ -145,10 +138,10 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
     ## find largest gap
     left <- boundary$left[currentBoundary]
     right <- boundary$right[currentBoundary]
-    currentBoundary <- currentBoundary-1L
-    gaps <- d[left:(right-1L)]
+    currentBoundary <- currentBoundary - 1L
+    gaps <- d[left:(right - 1L)]
 
-    gapIdx <- which.max(gaps)+left-1L
+    gapIdx <- which.max(gaps) + left - 1L
 
     ## left side
     l <- grouper(mass=mass[left:gapIdx],
@@ -157,7 +150,7 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
                  tolerance=tolerance, ...)
     ## further splitting needed?
     if (is.na(l[1L])) {
-      currentBoundary <- currentBoundary+1L
+      currentBoundary <- currentBoundary + 1L
       boundary$left[currentBoundary] <- left
       boundary$right[currentBoundary] <- gapIdx
     } else {
@@ -165,29 +158,28 @@ binPeaks <- function(l, method=c("strict", "relaxed"), tolerance=0.002) {
     }
 
     ## right side
-    r <- grouper(mass=mass[(gapIdx+1L):right],
-                 intensities=intensities[(gapIdx+1L):right],
-                 samples=samples[(gapIdx+1L):right],
+    r <- grouper(mass=mass[(gapIdx + 1L):right],
+                 intensities=intensities[(gapIdx + 1L):right],
+                 samples=samples[(gapIdx + 1L):right],
                  tolerance=tolerance, ...)
     ## further splitting needed?
     if (is.na(r[1L])) {
-      currentBoundary <- currentBoundary+1L
-      boundary$left[currentBoundary] <- gapIdx+1L
+      currentBoundary <- currentBoundary + 1L
+      boundary$left[currentBoundary] <- gapIdx + 1L
       boundary$right[currentBoundary] <- right
     } else {
-      mass[(gapIdx+1L):right] <- r
+      mass[(gapIdx + 1L):right] <- r
     }
 
     ## stack size have to be increased?
     ## (should rarely happen because recursion deep is mostly < 20)
     if (currentBoundary == nBoundaries) {
-      nBoundaries <- floor(nBoundaries*1.5)
+      nBoundaries <- floor(nBoundaries * 1.5)
       boundary$left <- c(boundary$left,
-                         double(nBoundaries-currentBoundary))
+                         double(nBoundaries - currentBoundary))
       boundary$right <- c(boundary$right,
-                          double(nBoundaries-currentBoundary))
+                          double(nBoundaries - currentBoundary))
     }
   }
-  return(mass)
+  mass
 }
-
diff --git a/R/calculateLabelPositions-methods.R b/R/calculateLabelPositions-methods.R
index a740897..d6fd2da 100644
--- a/R/calculateLabelPositions-methods.R
+++ b/R/calculateLabelPositions-methods.R
@@ -34,22 +34,23 @@ setMethod(f=".calculateLabelPositions",
   signature=signature(object="MassPeaks"),
   definition=function(object, x, y, peakLabels, adj, cex, maxSteps=100L) {
   ## start with smallest peak
-  i <- sort(y, index.return=TRUE, method="quick")$ix
+  i <- sort.int(y, index.return=TRUE, method="quick")$ix
 
   ## calculate label rectangles
   rects <- .textLabelRects(x[i], y[i], peakLabels[i], adj=adj, cex=cex)
 
   ## move rectangles around to avoid collisons
-  for (j in seq(along=x)) {
-    rects[j, ] <- .testLabelOverlap(object, rects, currentIndex=j, maxSteps=maxSteps)
+  for (j in seq_along(x)) {
+    rects[j, ] <- .testLabelOverlap(object, rects, currentIndex=j,
+                                    maxSteps=maxSteps)
   }
 
   ## undo sorting
   rects[i, ] <- rects
 
-  return(list(x=rects[, "x"], y=rects[, "y"],
-              xleft=rects[, "x0"], ybottom=rects[, "y0"],
-              xright=rects[, "x1"], ytop=rects[, "y1"]))
+  list(x=rects[, "x"], y=rects[, "y"],
+       xleft=rects[, "x0"], ybottom=rects[, "y0"],
+       xright=rects[, "x1"], ytop=rects[, "y1"])
 })
 
 ## .testLabelOverlap
@@ -67,23 +68,26 @@ setMethod(f=".testLabelOverlap",
   signature=signature(object="MassPeaks"),
   definition=function(object, rects, currentIndex, maxSteps) {
 
-  r <- pi/180L*c(90, as.vector(rbind(seq(80L, 40L, by=-10L),
-                                     seq(100L, 140L, by=10L))))
+  r <- pi / 180L * c(90, as.vector(rbind(seq(80L, 40L, by=-10L),
+                                         seq(100L, 140L, by=10L))))
 
   for (k in 0L:maxSteps) {
     ## move up
     cur <- rects[currentIndex, ]
     cur[c("y0", "y1", "y")] <- cur[c("y0", "y1", "y")] + k * cur[c("h")]
-    isOverlapped <- .labelOverlap(object, cur, rects[1L:(currentIndex-1L), ])
+    isOverlapped <- .labelOverlap(object, cur,
+                                  rects[seq_len(currentIndex - 1L), ])
 
     if (isOverlapped) {
       for (l in r) {
         ## move in curve
         oldcur <- cur
-        cur[c("y0", "y1", "y")] <- cur[c("y0", "y1", "y")] + sin(l) * cur[c("h")]
-        cur[c("x0", "x1", "x")] <- cur[c("x0", "x1", "x")] + cos(l) * cur[c("w")]
-        isOverlapped <- .labelOverlap(object, cur, rects[1L:(currentIndex-1L), ])
-
+        cur[c("y0", "y1", "y")] <- cur[c("y0", "y1", "y")] +
+                                   sin(l) * cur[c("h")]
+        cur[c("x0", "x1", "x")] <- cur[c("x0", "x1", "x")] +
+                                   cos(l) * cur[c("w")]
+        isOverlapped <- .labelOverlap(object, cur,
+                                      rects[seq_len(currentIndex - 1L), ])
         if (!isOverlapped) {
           ## success
           return(cur)
@@ -96,7 +100,7 @@ setMethod(f=".testLabelOverlap",
     }
   }
   ## no success, return original pos
-  return(rects[currentIndex, ])
+  rects[currentIndex, ]
 })
 
 ## .labelOverlap
@@ -134,6 +138,5 @@ setMethod(f=".labelOverlap",
                       (y[2L] > rects[, 2L] & y[2L] < rects[, 4L]) |
                       (y[1L] < rects[, 2L] & y[2L] > rects[, 4L])))
 
-  return(textOverlap)
+  textOverlap
 })
-
diff --git a/R/calibrateIntensity-functions.R b/R/calibrateIntensity-functions.R
index 9a4ff14..41cb1e3 100644
--- a/R/calibrateIntensity-functions.R
+++ b/R/calibrateIntensity-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2013 Sebastian Gibb
+## Copyright 2013-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -28,13 +28,7 @@
 ##  double, calibrated intensity values
 ##
 .calibrateIntensitySimple <- function(y, offset=0L, scaling=1L) {
-  if (is.function(offset)) {
-    offset <- offset(y)
-  }
-  if (is.function(scaling)) {
-    scaling <- scaling(y)
-  }
-  return( (y-offset)/scaling )
+  (y - offset) / scaling
 }
 
 ## .calibrateProbabilisticQuotientNormalization
@@ -67,15 +61,12 @@
   ## 2. median reference spectrum
   reference <- .averageMassSpectra(l, fun=.colMedians, mergeMetaData=FALSE)
 
-  return(lapply(l, function(x) {
+  lapply(l, function(x) {
     ## 3. quotient calculation
-    q <- approxfun(x)(reference at mass)/reference at intensity
+    q <- approxfun(x)(reference at mass) / reference at intensity
     ## 4. median
     m <- median(q, na.rm=TRUE)
     ## 5. divide by median
-    x <- .transformIntensity(x, fun=.calibrateIntensitySimple,
-                             offset=0L, scaling=m)
-    return(x)
-  }))
+    .transformIntensity(x, fun=.calibrateIntensitySimple, offset=0L, scaling=m)
+  })
 }
-
diff --git a/R/calibrateIntensity-methods.R b/R/calibrateIntensity-methods.R
index 1a294ad..485273c 100644
--- a/R/calibrateIntensity-methods.R
+++ b/R/calibrateIntensity-methods.R
@@ -24,10 +24,17 @@ setMethod(f="calibrateIntensity",
 
   method <- match.arg(method)
 
-  object <- switch(method,
+  switch(method,
     "TIC" = {
-      .transformIntensity(object, fun=.calibrateIntensitySimple,
-                          offset=0L, scaling=totalIonCurrent(object))
+      optArgs <- list(...)
+
+      if (!is.null(optArgs$range)) {
+        tic <- totalIonCurrent(trim(object, range=optArgs$range))
+      } else {
+        tic <- totalIonCurrent(object)
+      }
+      .transformIntensity(object, fun=.calibrateIntensitySimple, offset=0L,
+                          scaling=tic)
     },
     "PQN" = {
       stop(dQuote("PQN"),
@@ -35,14 +42,9 @@ setMethod(f="calibrateIntensity",
     },
     "median" = {
       .transformIntensity(object, fun=.calibrateIntensitySimple,
-                          offset=0L, scaling=median)
-    },
-    {
-      stop("Unknown ", sQuote("method"), ".")
+                          offset=0L, scaling=median(object at intensity))
     }
   )
-
-  return(object)
 })
 
 ## list
@@ -56,18 +58,13 @@ setMethod(f="calibrateIntensity",
 
   method <- match.arg(method)
 
-  object <- switch(method,
+  switch(method,
     "TIC" = ,
     "median" = {
       lapply(object, calibrateIntensity, method=method, ...)
     },
     "PQN" = {
       .calibrateProbabilisticQuotientNormalization(object)
-    },
-    {
-      stop("Unknown ", sQuote("method"), ".")
     }
   )
-  return(object)
 })
-
diff --git a/R/colMedians-functions.R b/R/colMedians-functions.R
index 00cfcee..13eeeb8 100644
--- a/R/colMedians-functions.R
+++ b/R/colMedians-functions.R
@@ -19,6 +19,5 @@
 .colMedians <- function(x, na.rm=FALSE) {
   stopifnot(is.matrix(x))
   stopifnot(is.logical(na.rm))
-  return(.Call("C_colMedians", x, na.rm))
+  .Call("C_colMedians", x, na.rm)
 }
-
diff --git a/R/constructor-functions.R b/R/constructor-functions.R
index 96b164c..1d54ce6 100644
--- a/R/constructor-functions.R
+++ b/R/constructor-functions.R
@@ -30,8 +30,7 @@
 ##  a MassSpectrum object
 ##
 createMassSpectrum <- function(mass, intensity, metaData=list()) {
-  return(new(Class="MassSpectrum", mass=mass, intensity=intensity,
-             metaData=metaData))
+  new(Class="MassSpectrum", mass=mass, intensity=intensity, metaData=metaData)
 }
 
 ## end of MassSpectrum
@@ -50,11 +49,10 @@ createMassSpectrum <- function(mass, intensity, metaData=list()) {
 ##  a MassPeaks object
 ##
 createMassPeaks <- function(mass, intensity,
-                            snr=as.double(rep(NA, length(intensity))),
+                            snr=as.double(rep.int(NA, length(intensity))),
                             metaData=list()) {
-  return(new(Class="MassPeaks", mass=mass, intensity=intensity, snr=snr,
-             metaData=metaData))
+  new(Class="MassPeaks", mass=mass, intensity=intensity, snr=snr,
+      metaData=metaData)
 }
 
 ## end of MassPeaks
-
diff --git a/R/coordinates-methods.R b/R/coordinates-methods.R
new file mode 100644
index 0000000..3a7ecda
--- /dev/null
+++ b/R/coordinates-methods.R
@@ -0,0 +1,81 @@
+## Copyright 2015 Sebastian Gibb
+## <mail at sebastiangibb.de>
+##
+## This file is part of MALDIquant for R and related languages.
+##
+## MALDIquant is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## MALDIquant is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
+
+## AbstractMassObject
+setMethod(f="coordinates",
+          signature=signature(object="AbstractMassObject"),
+          definition=function(object, ...) {
+
+  object at metaData$imaging$pos
+})
+
+## AbstractMassObject
+setReplaceMethod(f="coordinates",
+                 signature=signature(object="AbstractMassObject",
+                                     value="numeric"),
+                 definition=function(object, value) {
+
+  if (!length(value) %in% c(2L, 3L)) {
+    stop("2 or 3 coordinates are needed!")
+  }
+  object at metaData$imaging$pos <- value
+  object
+})
+
+setReplaceMethod(f="coordinates",
+                 signature=signature(object="AbstractMassObject",
+                                     value="matrix"),
+                 definition=function(object, value) {
+  if (!ncol(value) %in% c(2L, 3L)) {
+    stop("2 or 3 coordinates are needed!")
+  }
+  if (nrow(value) != 1L) {
+    warning("all rows but the first are ignored!")
+  }
+  object at metaData$imaging$pos <- value[1L, ]
+  object
+})
+
+## list
+setMethod(f="coordinates",
+          signature=signature(object="list"),
+          definition=function(object, adjust=FALSE) {
+
+  ## test arguments
+  .stopIfNotIsMassObjectList(object)
+
+  m <- do.call(rbind, lapply(object, coordinates))
+  colnames(m) <- c("x", "y", "z")[seq_len(ncol(m))]
+
+  if (adjust) {
+    m <- apply(m, MARGIN=2L, function(x)x - min(x) + 1L)
+  }
+  m
+
+})
+
+## list
+setReplaceMethod(f="coordinates",
+                 signature=signature(object="list",
+                                     value="matrix"),
+                 definition=function(object, value) {
+  ## test arguments
+  .stopIfNotIsMassObjectList(object)
+
+  .mapply("coordinates<-", object, split(value, seq_len(nrow(value))))
+})
diff --git a/R/deprecated-functions.R b/R/deprecated-functions.R
index 0ef5ced..fa86964 100644
--- a/R/deprecated-functions.R
+++ b/R/deprecated-functions.R
@@ -56,7 +56,7 @@
 ##
 .deprecatedFunction <- function(version, old, new) {
   if (missing(old)) {
-    old <- parentCall <- sys.call(-1L)[[1]]
+    old <- sys.call(-1L)[[1]]
   }
 
   msg <- paste0("\"", old , "\" is deprecated.")
@@ -64,7 +64,7 @@
   if (!missing(new)) {
     msg <- paste0(msg, "\nUse \"", new, "\" instead. See help(\"", new ,"\").")
   }
-  return(.deprecated(version, msg))
+  .deprecated(version, msg)
 }
 
 ## .deprecatedArgument
@@ -91,6 +91,5 @@
     msg <- paste0(msg, "\nUse \"", new, "\" instead. See help(\"",
                   deparse(parentCall),"\").")
   }
-  return(.deprecated(version, msg))
+  .deprecated(version, msg)
 }
-
diff --git a/R/detectPeaks-methods.R b/R/detectPeaks-methods.R
index b359c42..749df60 100644
--- a/R/detectPeaks-methods.R
+++ b/R/detectPeaks-methods.R
@@ -29,21 +29,21 @@ setMethod(f="detectPeaks",
   }
 
   ## estimate noise
-  noise <- estimateNoise(object, method=method, ...)
+  noise <- .estimateNoise(x=object at mass, y=object at intensity, method=method, ...)
 
   ## find local maxima
   isLocalMaxima <- .findLocalMaximaLogical(object,
                                            halfWindowSize=halfWindowSize)
 
   ## include only local maxima which are above the noise
-  isAboveNoise <- object at intensity > (SNR * noise[, 2L])
+  isAboveNoise <- object at intensity > (SNR * noise)
 
   peakIdx <- which(isAboveNoise & isLocalMaxima)
 
-  return(createMassPeaks(mass=object at mass[peakIdx],
-                         intensity=object at intensity[peakIdx],
-                         snr=object at intensity[peakIdx]/noise[peakIdx, 2L],
-                         metaData=object at metaData))
+  createMassPeaks(mass=object at mass[peakIdx],
+                  intensity=object at intensity[peakIdx],
+                  snr=object at intensity[peakIdx] / noise[peakIdx],
+                  metaData=object at metaData)
 })
 
 ## list
@@ -54,6 +54,5 @@ setMethod(f="detectPeaks",
   ## test arguments
   .stopIfNotIsMassSpectrumList(object)
 
-  return(.mapply(detectPeaks, object, ...))
+  .mapply(detectPeaks, object, ...)
 })
-
diff --git a/R/determineWarpingFunctions-functions.R b/R/determineWarpingFunctions-functions.R
index 34cc7f6..4048eb6 100644
--- a/R/determineWarpingFunctions-functions.R
+++ b/R/determineWarpingFunctions-functions.R
@@ -55,9 +55,6 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
     },
     "cubic" = {
       .warpingFunctionCubic
-    },
-    {
-      stop("Unknown ", sQuote("method"), ".")
     }
   )
 
@@ -78,7 +75,7 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
     stop("Reference MassPeaks object contains no peaks!")
   }
 
-  if (length(reference) < 10) {
+  if (length(reference) < 10L) {
     warning("Reference MassPeaks object contains very few peaks (n == ",
             length(reference), "). The warping could be instable. ",
             "Consider to reduce ", sQuote("minFrequency"),
@@ -105,12 +102,11 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
   intensities <- .unlist(lapply(tmpPeakList, function(x)x at intensity))
 
   ## store original mass sample number/id
-  samples <- .unlist(lapply(1L:length(tmpPeakList), function(x) {
-                return(rep(x, length(tmpPeakList[[x]])))
-  }))
+  samples <- rep.int(seq_along(tmpPeakList),
+                     .unlist(lapply(tmpPeakList, length)))
 
   ## sort values by mass
-  s <- sort(mass, method="quick", index.return=TRUE)
+  s <- sort.int(mass, method="quick", index.return=TRUE)
 
   mass <- s$x
   intensities <- intensities[s$ix]
@@ -123,13 +119,11 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
                           grouper=.grouperRelaxedHighestAtReference)
 
   ## group mass/intensities by sample ids
-  lIdx <- tapply(X=1L:length(binnedMass), INDEX=samples, FUN=function(x) {
-      return(x)
-  })
+  lIdx <- split(seq_along(binnedMass), samples)
 
   ## calculate differences
   binnedMass[binnedMass == 0L] <- NA
-  d <- binnedMass-mass
+  d <- binnedMass - mass
 
   ## each function which determines a warping function uses these 3 arguments
   arguments <- list(x=NULL, d=NULL)
@@ -146,13 +140,11 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
     arguments$d <- d[i][notNA]  ## difference to reference
 
     if (!length(arguments$x)) {
-      stop("Could not match any peak in spectrum ", samples[i[1L]]-1L,
+      stop("Could not match any peak in spectrum ", samples[i[1L]] - 1L,
            " to a reference peak.")
     }
 
-    w <- do.call(warpingFunction, arguments)
-
-    return(w)
+    do.call(warpingFunction, arguments)
   })
 
   ## clean misleading names (names == idx+1 because reference is idx == 1)
@@ -168,7 +160,7 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
               " but no non-interactive devices is available. ",
               "Using pdf() to create a default one.")
       pdf(paper="a4r", width=12)
-    } else if (dev.cur() == 1 && plotInteractive) {
+    } else if (dev.cur() == 1L && plotInteractive) {
       warning(sQuote("plot"), " is ", sQuote("TRUE"),
               " but no interactive devices is available. ",
               "Using dev.new() to create a default one.")
@@ -198,9 +190,9 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
       l <- list(l)
     }
 
-    for (i in seq(along=l)) {
+    for (i in seq_along(l)) {
       ## fetch changed mass == aligned peaks
-      notNA <- !is.na(binnedMass[lIdx[[i+1L]]])
+      notNA <- !is.na(binnedMass[lIdx[[i + 1L]]])
 
       if (is.null(givenPlotArgs$main)) {
         plotArgs$main <- paste0("sample ", i, " vs reference\n",
@@ -214,7 +206,7 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
 
       ## plot reference vs sample
       plotArgs$x <- l[[i]]@mass[notNA]
-      plotArgs$y <- d[lIdx[[i+1L]]][notNA]
+      plotArgs$y <- d[lIdx[[i + 1L]]][notNA]
       do.call(plot.default, plotArgs)
 
       ## draw warping function
@@ -226,6 +218,5 @@ determineWarpingFunctions <- function(l, reference, tolerance=0.002,
     }
   }
 
-  return(warpingFunctions)
+  warpingFunctions
 }
-
diff --git a/R/doByLabels-functions.R b/R/doByLabels-functions.R
index d2b1a37..2b40e6e 100644
--- a/R/doByLabels-functions.R
+++ b/R/doByLabels-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2012-2013 Sebastian Gibb
+## Copyright 2012-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -27,7 +27,7 @@
 ## returns:
 ##  list of modified AbstractMassObject objects
 ##
-.doByLabels <- function(l, labels, FUN, ...) {
+.doByLabels <- function(l, labels, FUN, ..., mc.cores=1L) {
 
   ## test parameters
   .stopIfNotIsMassObjectList(l)
@@ -49,7 +49,7 @@
     }
 
     ## replace tapply by split to preserve order
-    tmp <- lapply(split(unlist(l), labels), FUN=FUN, ...)
+    tmp <- .lapply(split(unlist(l), labels), FUN=FUN, ..., mc.cores=mc.cores)
 
     k <- unlist(tmp)
 
@@ -60,6 +60,5 @@
     k <- FUN(l, ...)
   }
 
-  return(k)
+  k
 }
-
diff --git a/R/estimateBaseline-functions.R b/R/estimateBaseline-functions.R
index 8413a3d..99b24a3 100644
--- a/R/estimateBaseline-functions.R
+++ b/R/estimateBaseline-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2014 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -16,6 +16,38 @@
 ## You should have received a copy of the GNU General Public License
 ## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
 
+## .estimateBaseline
+##  estimating the baseline of a spectrum
+##
+## params:
+##  x: vector of x values (mass)
+##  y: vector of y values (intensity)
+##  method: method to use
+##  ...: further arguments passed to "method"
+##
+## returns:
+##  numeric, estimated baseline (y)
+##
+.estimateBaseline <- function(x, y, method=c("SNIP", "TopHat", "ConvexHull",
+                                             "median"), ...) {
+  method <- match.arg(method)
+
+  switch(method,
+         "SNIP" = {
+           .estimateBaselineSnip(x, y, ...)
+         },
+         "TopHat" = {
+           .estimateBaselineTopHat(x, y, ...)
+         },
+         "ConvexHull" = {
+           .estimateBaselineConvexHull(x, y, ...)
+         },
+         "median" = {
+           .estimateBaselineMedian(x, y, ...)
+         }
+  )
+}
+
 ## estimateBaselineConvexHull
 ##  estimate baseline by creating a convex hull
 ##
@@ -28,11 +60,10 @@
 ##  y: vector of y values
 ##
 ## returns:
-##  a matrix of the estimate baseline (col1: mass; col2: intensity)
+##  numeric, estimated baseline (y)
 ##
-
 .estimateBaselineConvexHull <- function(x, y) {
-  return(cbind(x=x, y=.Call("C_lowerConvexHull", x, y)))
+  .Call("C_lowerConvexHull", x, y)
 }
 
 ## estimateBaselineMedian
@@ -44,14 +75,12 @@
 ##  halfWindowSize: size of local window
 ##
 ## returns:
-##  a matrix of the estimate baseline (col1: mass; col2: intensity)
+##  numeric, estimated baseline (y)
 ##
 .estimateBaselineMedian <- function(x, y, halfWindowSize=100L) {
   .stopIfNotIsValidHalfWindowSize(halfWindowSize=halfWindowSize, n=length(x))
 
-  y <- runmed(y, k=2L*halfWindowSize+1L)
-
-  return(cbind(x, y))
+  as.vector(runmed(y, k=2L * halfWindowSize + 1L))
 }
 
 ## estimateBaselineSnip
@@ -82,10 +111,10 @@
 ##  decreasing: use a decreasing clipping window
 ##
 ## returns:
-##  a matrix of the estimate baseline (col1: mass; col2: intensity)
-
+##  numeric, estimated baseline (y)
+##
 .estimateBaselineSnip <- function(x, y, iterations=100L, decreasing=TRUE) {
-  return(cbind(x=x, y=.Call("C_snip", y, iterations, decreasing)))
+  .Call("C_snip", y, iterations, decreasing)
 }
 
 ## estimateBaselineTopHat
@@ -97,15 +126,11 @@
 ##  halfWindowSize: size of local window
 ##
 ## returns:
-##  a matrix of the estimate baseline (col1: mass; col2: intensity)
+##  numeric, estimated baseline (y)
 ##
 .estimateBaselineTopHat <- function(x, y, halfWindowSize=100L) {
-
   .stopIfNotIsValidHalfWindowSize(halfWindowSize=halfWindowSize, n=length(x))
 
-  e <- .erosion(y, halfWindowSize=halfWindowSize)
-  y <- .dilation(e, halfWindowSize=halfWindowSize)
-
-  return(cbind(x, y))
+  .dilation(.erosion(y, halfWindowSize=halfWindowSize),
+            halfWindowSize=halfWindowSize)
 }
-
diff --git a/R/estimateBaseline-methods.R b/R/estimateBaseline-methods.R
index 4c667a7..4db0115 100644
--- a/R/estimateBaseline-methods.R
+++ b/R/estimateBaseline-methods.R
@@ -22,33 +22,11 @@ setMethod(f="estimateBaseline",
           definition=function(object, method=c("SNIP", "TopHat", "ConvexHull",
                                                "median"),
                               ...) {
-
-  ## empty spectrum?
   if (.isEmptyWarning(object)) {
     return(NA)
   }
 
-  method <- match.arg(method)
-
-  b <- switch(method,
-              "SNIP" = {
-                .estimateBaselineSnip(object at mass, object at intensity, ...)
-              },
-              "TopHat" = {
-                .estimateBaselineTopHat(object at mass, object at intensity, ...)
-              },
-              "ConvexHull" = {
-                .estimateBaselineConvexHull(object at mass, object at intensity)
-              },
-              "median" = {
-                .estimateBaselineMedian(object at mass, object at intensity, ...)
-              },
-              {
-                stop("Unknown ", sQuote("method"), ".")
-              }
-  )
-
-  colnames(b) <- c("mass", "intensity")
-  return(b)
+  cbind(mass=object at mass,
+        intensity=.estimateBaseline(x=object at mass, y=object at intensity,
+                                    method=method, ...))
 })
-
diff --git a/R/estimateNoise-functions.R b/R/estimateNoise-functions.R
index c639709..29d5328 100644
--- a/R/estimateNoise-functions.R
+++ b/R/estimateNoise-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2014 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -16,7 +16,7 @@
 ## You should have received a copy of the GNU General Public License
 ## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
 
-## estimateNoise
+## .estimateNoise
 ##  estimating the noise of a spectrum
 ##
 ## params:
@@ -26,26 +26,20 @@
 ##  ...: further arguments passed to "method"
 ##
 ## returns:
-##  a matrix of the estimate noise (col1: mass; col2: intensity)
+##  numeric, estimated noise (y)
 ##
 .estimateNoise <- function(x, y, method=c("MAD", "SuperSmoother"), ...) {
 
   method <- match.arg(method)
 
-  n <- switch(method,
-              "MAD" = {
-                .estimateNoiseMad(x, y)
-              },
-              "SuperSmoother" = {
-                .estimateNoiseSuperSmoother(x, y, ...)
-              },
-              {
-                stop("Unknown ", sQuote("method"), ".")
-              }
+  switch(method,
+         "MAD" = {
+           .estimateNoiseMad(x, y)
+         },
+         "SuperSmoother" = {
+           .estimateNoiseSuperSmoother(x, y, ...)
+         }
   )
-
-  colnames(n) <- c("mass", "intensity")
-  return(n)
 }
 
 ## estimateNoiseMad
@@ -56,10 +50,10 @@
 ##  y: vector of y values
 ##
 ## returns:
-##  a matrix of the estimate noise (col1: mass; col2: intensity)
+##  numeric, estimated noise (y)
 ##
 .estimateNoiseMad <- function(x, y) {
-  return(cbind(x, rep(stats::mad(y), times=length(x))))
+  rep.int(stats::mad(y), length(x))
 }
 
 ## estimateNoiseSuperSmoother
@@ -71,9 +65,8 @@
 ##  ...: further arguments to passed to supsmu
 ##
 ## returns:
-##  a matrix of the estimate noise (col1: mass; col2: intensity)
+##  numeric, estimated noise (y)
 ##
 .estimateNoiseSuperSmoother <- function(x, y, ...) {
-  return(cbind(x, stats::supsmu(x=x, y=y, ...)$y))
+  stats::supsmu(x=x, y=y, ...)$y
 }
-
diff --git a/R/estimateNoise-methods.R b/R/estimateNoise-methods.R
index c71e662..450fe06 100644
--- a/R/estimateNoise-methods.R
+++ b/R/estimateNoise-methods.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2013 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -21,11 +21,11 @@ setMethod(f="estimateNoise",
           signature=signature(object="MassSpectrum"),
           definition=function(object, method=c("MAD", "SuperSmoother"),
                               ...) {
-
   if (.isEmptyWarning(object)) {
     return(0L)
   }
 
-  return(.estimateNoise(x=object at mass, y=object at intensity, method=method, ...))
+  cbind(mass=object at mass,
+        intensity=.estimateNoise(x=object at mass, y=object at intensity,
+                                 method=method, ...))
 })
-
diff --git a/R/filterPeaks-functions.R b/R/filterPeaks-functions.R
index 117ee43..edf6275 100644
--- a/R/filterPeaks-functions.R
+++ b/R/filterPeaks-functions.R
@@ -37,7 +37,7 @@ filterPeaks <- function(l, minFrequency, minNumber, labels,
 
   ## labels
   if (missing(labels)) {
-    labels <- rep_len(0L, length(l))
+    labels <- rep.int(0L, length(l))
   }
 
   ## drop unused levels and turn argument into factor
@@ -79,7 +79,7 @@ filterPeaks <- function(l, minFrequency, minNumber, labels,
   idx <- lapply(ll, function(x)which(labels == x))
 
   ## collect whitelists
-  for (i in seq(along=idx)) {
+  for (i in seq_along(idx)) {
     wl <- .whitelist(m, idx[[i]],
                      minFrequency=minFrequency[i], minNumber=minNumber[i])
     if (sum(wl)) {
@@ -99,7 +99,7 @@ filterPeaks <- function(l, minFrequency, minNumber, labels,
   w <- w & m
 
   ## turn matrix back into MassPeaks objects
-  for (i in seq(along=l)) {
+  for (i in seq_along(l)) {
     j <- which(as.logical(m[i, ]))
     include <- which(w[i, j])
     l[[i]]@mass <- l[[i]]@mass[include]
@@ -107,7 +107,7 @@ filterPeaks <- function(l, minFrequency, minNumber, labels,
     l[[i]]@snr <- l[[i]]@snr[include]
   }
 
-  return(l)
+  l
 }
 
 ## .whitelist
@@ -147,8 +147,7 @@ filterPeaks <- function(l, minFrequency, minNumber, labels,
   }
 
   ## calculate minimal number of peaks
-  minPeakNumber <- max(minFrequency*length(rows), minNumber, na.rm=TRUE)
+  minPeakNumber <- max(minFrequency * length(rows), minNumber, na.rm=TRUE)
 
-  return(colSums(m[rows, , drop=FALSE]) >= minPeakNumber)
+  colSums(m[rows, , drop=FALSE]) >= minPeakNumber
 }
-
diff --git a/R/findEmptyMassObjects-functions.R b/R/findEmptyMassObjects-functions.R
index 359606d..6673b15 100644
--- a/R/findEmptyMassObjects-functions.R
+++ b/R/findEmptyMassObjects-functions.R
@@ -31,6 +31,5 @@ findEmptyMassObjects <- function(l) {
 
   isEmpty <- vapply(l, isEmpty, logical(1L))
 
-  return(which(isEmpty))
+  which(isEmpty)
 }
-
diff --git a/R/findLocalMaxima-methods.R b/R/findLocalMaxima-methods.R
index 94c2b55..77eb521 100644
--- a/R/findLocalMaxima-methods.R
+++ b/R/findLocalMaxima-methods.R
@@ -27,11 +27,7 @@ setMethod(f=".findLocalMaxima",
 
   localMaxima <- .findLocalMaximaLogical(object, halfWindowSize=halfWindowSize)
 
-  m <- cbind(object at mass, object at intensity)[localMaxima,]
-
-  colnames(m) <- c("mass", "intensity")
-
-  return(m)
+  cbind(mass=object at mass, intensity=object at intensity)[localMaxima,]
 })
 
 setMethod(f=".findLocalMaximaLogical",
@@ -45,8 +41,5 @@ setMethod(f=".findLocalMaximaLogical",
   .stopIfNotIsValidHalfWindowSize(halfWindowSize=halfWindowSize,
                                   n=length(object))
 
-  localMaxima <- .localMaxima(object at intensity, halfWindowSize=halfWindowSize)
-
-  return(localMaxima)
+  .localMaxima(object at intensity, halfWindowSize=halfWindowSize)
 })
-
diff --git a/R/grouper-functions.R b/R/grouper-functions.R
index 028a397..1d4a2e9 100644
--- a/R/grouper-functions.R
+++ b/R/grouper-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2012-2013 Sebastian Gibb
+## Copyright 2012-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -42,11 +42,11 @@
   meanMass <- mean(mass)
 
   ## all peaks in range?
-  if (any(abs(mass-meanMass)/meanMass > tolerance)) {
+  if (any(abs(mass - meanMass) / meanMass > tolerance)) {
     return(NA)
   }
 
-  return(meanMass)
+  meanMass
 }
 
 ## .grouperRelaxed
@@ -69,13 +69,14 @@
   meanMass <- mean(mass)
 
   ## all peaks in range?
-  if (any(abs(mass-meanMass)/meanMass > tolerance)) {
+  if (any(abs(mass - meanMass) / meanMass > tolerance)) {
     return(NA)
   }
 
   ## choose highest peak in duplicates
   if (anyDuplicated(samples)) {
-    s <- sort(intensities, method="quick", decreasing=TRUE, index.return=TRUE)
+    s <- sort.int(intensities, method="quick", decreasing=TRUE,
+                  index.return=TRUE)
     samples <- samples[s$ix]
 
     noDup <- !duplicated(samples)
@@ -86,9 +87,9 @@
     mass[noDup] <- mean(mass[noDup])
 
     return(mass)
-  } else {
-    return(meanMass)
   }
+
+  meanMass
 }
 
 ## .grouperRelaxedHighestAtReference
@@ -123,13 +124,14 @@
   meanMass <- mass[ref]
 
   ## all peaks in range?
-  if (any(abs(mass-meanMass)/meanMass > tolerance)) {
+  if (any(abs(mass - meanMass) / meanMass > tolerance)) {
     return(NA)
   }
 
   ## choose highest peak in duplicates
   if (anyDuplicated(samples)) {
-    s <- sort(intensities, method="quick", decreasing=TRUE, index.return=TRUE)
+    s <- sort.int(intensities, method="quick", decreasing=TRUE,
+                  index.return=TRUE)
     sSamples <- samples[s$ix]
 
     noDup <- !duplicated(sSamples)
@@ -138,8 +140,7 @@
     mass[s$ix] <- sMass
 
     return(mass)
-  } else {
-    return(meanMass)
   }
-}
 
+  meanMass
+}
diff --git a/R/intensity-methods.R b/R/intensity-methods.R
index d7ec27f..ff6bdfc 100644
--- a/R/intensity-methods.R
+++ b/R/intensity-methods.R
@@ -19,9 +19,9 @@
 ## AbstractMassObject
 setMethod(f="intensity",
           signature=signature(object="AbstractMassObject"),
-          definition=function(object) {
+          definition=function(object, ...) {
 
-  return(object at intensity)
+  object at intensity
 })
 
 ## AbstractMassObject
@@ -36,6 +36,5 @@ setReplaceMethod(f="intensity",
     stop("Lengths of intensity(", length(object at intensity),
          ") and value (", length(value), ") have to be equal.")
   }
-  return(object)
+  object
 })
-
diff --git a/R/intensityMatrix-functions.R b/R/intensityMatrix-functions.R
index 34541eb..7efdb78 100644
--- a/R/intensityMatrix-functions.R
+++ b/R/intensityMatrix-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2013 Sebastian Gibb
+## Copyright 2011-2014 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -28,13 +28,6 @@
 ##
 intensityMatrix <- function(peaks, spectra) {
 
-  ## deprecated for MassSpectrum objects
-  if (isMassSpectrumList(peaks)) {
-    .deprecated("1.8.4", "\"intensityMatrix\" is deprecated ",
-                "for lists of MassSpectrum objects.")
-    return(.intensityMatrixDeprecated(peaks))
-  }
-
   ## test arguments
   .stopIfNotIsMassPeaksList(peaks)
 
@@ -53,10 +46,10 @@ intensityMatrix <- function(peaks, spectra) {
 
     approxSpectra <- lapply(spectra, approxfun, yleft=0L, yright=0L)
 
-    for (i in seq(along=approxSpectra)) {
+    for (i in seq_along(approxSpectra)) {
       m[i, isNa[i, ]] <- approxSpectra[[i]](uniqueMass[isNa[i, ]])
     }
   }
 
-  return(m)
+  m
 }
diff --git a/R/irregular-functions.R b/R/irregular-functions.R
index 7544247..86a40c1 100644
--- a/R/irregular-functions.R
+++ b/R/irregular-functions.R
@@ -29,6 +29,5 @@
   d <- diff(x)
   d <- d[-1L] < head(d, -1L)
 
-  return(mean(d))
+  mean(d)
 }
-
diff --git a/R/isEmpty-methods.R b/R/isEmpty-methods.R
index 6901e06..4c595e7 100644
--- a/R/isEmpty-methods.R
+++ b/R/isEmpty-methods.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2013 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -21,8 +21,7 @@ setMethod(f="isEmpty",
           signature=signature(x="AbstractMassObject"),
           definition=function(x) {
 
-  return(length(x at intensity) == 0L ||
-         sum(as.double(x at intensity), na.rm=TRUE) == 0L)
+  !sum(as.double(x at intensity), na.rm=TRUE)
 })
 
 setMethod(f=".isEmptyWarning",
@@ -42,6 +41,5 @@ setMethod(f=".isEmptyWarning",
     return(TRUE)
   }
 
-  return(FALSE)
+  FALSE
 })
-
diff --git a/R/isFunctionList-functions.R b/R/isFunctionList-functions.R
index 911a2e1..2d3a53e 100644
--- a/R/isFunctionList-functions.R
+++ b/R/isFunctionList-functions.R
@@ -21,9 +21,7 @@
     return(FALSE)
   }
 
-  areFunctions <- length(x) &&
-                  all(.unlist(vapply(x, is.function, logical(1L))))
-  return(areFunctions)
+  length(x) && all(.unlist(vapply(x, is.function, logical(1L))))
 }
 
 .stopIfNotIsFunctionList <- function(x) {
@@ -31,8 +29,6 @@
     parentCall <- deparse(sys.call(-1L))
     stop(parentCall, " : ", sQuote(deparse(substitute(x))),
          " is no list of functions!", call.=FALSE)
-    return(FALSE)
   }
-  return(TRUE)
+  TRUE
 }
-
diff --git a/R/isMassObject-functions.R b/R/isMassObject-functions.R
index 491f7ae..8518680 100644
--- a/R/isMassObject-functions.R
+++ b/R/isMassObject-functions.R
@@ -17,13 +17,13 @@
 ## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
 
 .isMassObject <- function(x) {
-  return(inherits(x=x, what="AbstractMassObject"))
+  inherits(x=x, what="AbstractMassObject")
 }
 
 isMassSpectrum <- function(x) {
-  return(is(object=x, class2="MassSpectrum"))
+  is(object=x, class2="MassSpectrum")
 }
 
 isMassPeaks <- function(x) {
-  return(is(object=x, class2="MassPeaks"))
+  is(object=x, class2="MassPeaks")
 }
diff --git a/R/isMassObjectList-functions.R b/R/isMassObjectList-functions.R
index 9386823..32d2b38 100644
--- a/R/isMassObjectList-functions.R
+++ b/R/isMassObjectList-functions.R
@@ -21,9 +21,7 @@
     return(FALSE)
   }
 
-  areMassObjects <- length(x) &&
-                    all(unname(vapply(x, .isMassObject, logical(1L))))
-  return(areMassObjects)
+  length(x) && all(unname(vapply(x, .isMassObject, logical(1L))))
 }
 
 .stopIfNotIsMassObjectList <- function(x) {
@@ -31,9 +29,8 @@
     parentCall <- deparse(sys.call(-1L))
     stop(parentCall, " : ", sQuote(deparse(substitute(x))),
          " is no list of MALDIquant::AbstractMassObject objects!", call.=FALSE)
-    return(FALSE)
   }
-  return(TRUE)
+  TRUE
 }
 
 isMassSpectrumList <- function(x) {
@@ -41,9 +38,7 @@ isMassSpectrumList <- function(x) {
     return(FALSE)
   }
 
-  areMassSpectrumObjects <- length(x) &&
-                            all(unname(vapply(x, isMassSpectrum, logical(1L))))
-  return(areMassSpectrumObjects)
+  length(x) && all(unname(vapply(x, isMassSpectrum, logical(1L))))
 }
 
 .stopIfNotIsMassSpectrumList <- function(x) {
@@ -51,9 +46,8 @@ isMassSpectrumList <- function(x) {
     parentCall <- deparse(sys.call(-1L))
     stop(parentCall, " : ", sQuote(deparse(substitute(x))),
          " is no list of MALDIquant::MassSpectrum objects!", call.=FALSE)
-    return(FALSE)
   }
-  return(TRUE)
+  TRUE
 }
 
 isMassPeaksList <- function(x) {
@@ -61,9 +55,7 @@ isMassPeaksList <- function(x) {
     return(FALSE)
   }
 
-  areMassPeaksObjects <- length(x) &&
-                         all(unname(vapply(x, isMassPeaks, logical(1L))))
-  return(areMassPeaksObjects)
+  length(x) && all(unname(vapply(x, isMassPeaks, logical(1L))))
 }
 
 .stopIfNotIsMassPeaksList <- function(x) {
@@ -71,8 +63,6 @@ isMassPeaksList <- function(x) {
     parentCall <- deparse(sys.call(-1L))
     stop(parentCall, " : ", sQuote(deparse(substitute(x))),
          " is no list of MALDIquant::MassPeaks objects!", call.=FALSE)
-    return(FALSE)
   }
-  return(TRUE)
+  TRUE
 }
-
diff --git a/R/isRegular-methods.R b/R/isRegular-methods.R
index 3324959..45f3e25 100644
--- a/R/isRegular-methods.R
+++ b/R/isRegular-methods.R
@@ -22,6 +22,5 @@ setMethod(f="isRegular",
           definition=function(object, threshold=1e-3) {
 
   s <- .irregularScore(object at mass) <= threshold
-  return(!is.na(s) & s)
+  !is.na(s) & s
 })
-
diff --git a/R/isValidHalfWindowSize-functions.R b/R/isValidHalfWindowSize-functions.R
index 1f3af98..3bc8133 100644
--- a/R/isValidHalfWindowSize-functions.R
+++ b/R/isValidHalfWindowSize-functions.R
@@ -34,13 +34,12 @@
          " is too small!", call.=FALSE)
   }
 
-  windowSize <- halfWindowSize*2L+1L
+  windowSize <- halfWindowSize * 2L + 1L
 
   if (windowSize > n) {
     stop(parentCall, " : ", sQuote("halfWindowSize"),
          " is too large!", call.=FALSE)
   }
 
-  return(TRUE)
+  TRUE
 }
-
diff --git a/R/labelPeaks-methods.R b/R/labelPeaks-methods.R
index f791df8..caa3331 100644
--- a/R/labelPeaks-methods.R
+++ b/R/labelPeaks-methods.R
@@ -28,7 +28,7 @@ setMethod(f="labelPeaks",
 
   ## index
   if (missing(index) && missing(mass)) {
-    index <- 1L:length(object at mass)
+    index <- seq_along(object at mass)
   } else if (!missing(index) && is.logical(index)) {
     index <- which(index)
   }
@@ -70,7 +70,7 @@ setMethod(f="labelPeaks",
   }
 
   if (missing(absoluteVerticalPos)) {
-    y <- object at intensity[index]+verticalOffset
+    y <- object at intensity[index] + verticalOffset
   } else {
     y <- absoluteVerticalPos
   }
@@ -90,4 +90,3 @@ setMethod(f="labelPeaks",
   }
   text(x=x, y=y, labels=labels, adj=adj, cex=cex, ...)
 })
-
diff --git a/R/unlist-functions.R b/R/lapply-functions.R
similarity index 77%
copy from R/unlist-functions.R
copy to R/lapply-functions.R
index da041b6..c05067c 100644
--- a/R/unlist-functions.R
+++ b/R/lapply-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2012-2013 Sebastian Gibb
+## Copyright 2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -16,16 +16,15 @@
 ## You should have received a copy of the GNU General Public License
 ## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
 
-## .unlist
-##  wrapper for unlist
+## .lapply
+##  wrapper for lapply with different defaults
 ##
 ## params:
-##  x: an R object
+##  see ?lapply
 ##
 ## returns:
-##  see also ?unlist
+##  see ?lapply
 ##
-.unlist <- function(x) {
-  unlist(x, recursive=FALSE, use.names=FALSE)
+.lapply <- function(X, FUN, ..., mc.cores=1L) {
+  parallel::mclapply(X, FUN, ..., mc.cores=mc.cores)
 }
-
diff --git a/R/length-methods.R b/R/length-methods.R
index 9d6eaab..86a8fe4 100644
--- a/R/length-methods.R
+++ b/R/length-methods.R
@@ -21,6 +21,5 @@ setMethod(f="length",
           signature=signature(x="AbstractMassObject"),
           definition=function(x) {
 
-  return(length(x at intensity))
+  length(x at intensity)
 })
-
diff --git a/R/lines-methods.R b/R/lines-methods.R
index 95e4381..d70cb86 100644
--- a/R/lines-methods.R
+++ b/R/lines-methods.R
@@ -23,6 +23,5 @@ setMethod(f="lines",
         type=ifelse(isMassPeaks(x), "h", "l"),
         ...) {
 
-    lines(x=x at mass, y=x at intensity, type, ...);
-});
-
+    lines(x=x at mass, y=x at intensity, type, ...)
+})
diff --git a/R/localMaxima-functions.R b/R/localMaxima-functions.R
index c5cdf8a..aa97fdf 100644
--- a/R/localMaxima-functions.R
+++ b/R/localMaxima-functions.R
@@ -29,9 +29,7 @@
 ##
 
 .localMaxima <- function(y, halfWindowSize=1L) {
-  y <- c(rep(0L, halfWindowSize), y, rep(0L, halfWindowSize))
-  n <- length(y)
-  i <- (halfWindowSize+1L):(n-halfWindowSize)
-  return(.Call("C_localMaxima", y, halfWindowSize)[i])
+  y <- c(rep.int(0L, halfWindowSize), y, rep.int(0L, halfWindowSize))
+  i <- (halfWindowSize + 1L):(length(y) - halfWindowSize)
+  .Call("C_localMaxima", y, halfWindowSize)[i]
 }
-
diff --git a/R/mapply-functions.R b/R/mapply-functions.R
index bf87896..aa3bc9d 100644
--- a/R/mapply-functions.R
+++ b/R/mapply-functions.R
@@ -25,8 +25,8 @@
 ## returns:
 ##  see ?mapply
 ##
-.mapply <- function(FUN, ..., MoreArgs=NULL, SIMPLIFY=FALSE, USE.NAMES=FALSE) {
-  return(mapply(FUN=FUN, ..., MoreArgs=MoreArgs, SIMPLIFY=SIMPLIFY,
-                USE.NAMES=USE.NAMES))
+.mapply <- function(FUN, ..., MoreArgs=NULL, SIMPLIFY=FALSE, USE.NAMES=FALSE,
+                    mc.cores=1L) {
+  parallel::mcmapply(FUN=FUN, ..., MoreArgs=MoreArgs, SIMPLIFY=SIMPLIFY,
+                     USE.NAMES=USE.NAMES, mc.cores=mc.cores)
 }
-
diff --git a/R/mass-methods.R b/R/mass-methods.R
index bcd77bf..31a9e40 100644
--- a/R/mass-methods.R
+++ b/R/mass-methods.R
@@ -19,9 +19,9 @@
 ## AbstractMassObject
 setMethod(f="mass",
           signature=signature(object="AbstractMassObject"),
-          definition=function(object) {
+          definition=function(object, ...) {
 
-  return(object at mass)
+  object at mass
 })
 
 ## AbstractMassObject
@@ -35,6 +35,5 @@ setReplaceMethod(f="mass",
     stop("Lengths of mass (", length(object at mass), ") and value (",
          length(value), ") have to be equal.")
   }
-  return(object)
+  object
 })
-
diff --git a/R/memoryUsage-functions.R b/R/memoryUsage-functions.R
index 424dcb6..ca39e38 100644
--- a/R/memoryUsage-functions.R
+++ b/R/memoryUsage-functions.R
@@ -28,9 +28,8 @@
 .memoryUsageStr <- function(x) {
   os <- object.size(x)
   iec <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB")
-  l <- trunc(log(os)/log(1024L))
-  i <- pmin(l+1L, 9L)
+  l <- trunc(log(os) / log(1024L))
+  i <- pmin(l + 1L, 9L)
 
-  return(paste(round(os/(1024L^l), digits=3L), iec[i]))
+  paste(round(os / (1024L^l), digits=3L), iec[i])
 }
-
diff --git a/R/merge-functions.R b/R/merge-functions.R
index 446a271..c99ba2a 100644
--- a/R/merge-functions.R
+++ b/R/merge-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2011-2014 Sebastian Gibb
+## Copyright 2011-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -27,8 +27,8 @@
 ## returns:
 ##  a new MassPeaks object or a list of new MassPeaks objects
 ##
-mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
-                            ignore.na=TRUE) {
+mergeMassPeaks <- function(l, labels, method=c("mean", "median", "sum"),
+                           ignore.na=TRUE, ...) {
 
   ## test arguments
   .stopIfNotIsMassPeaksList(l)
@@ -44,14 +44,11 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
               },
               "sum" = {
                 colSums
-              },
-              {
-                stop("Unknown ", sQuote("method"), ".")
               }
   )
 
-  return(.doByLabels(l=l, labels=labels, FUN=.mergeMassPeaks, fun=fun,
-                     ignore.na=ignore.na))
+  .doByLabels(l=l, labels=labels, FUN=.mergeMassPeaks, fun=fun,
+              ignore.na=ignore.na, ...)
 }
 
 ## .mergeMassPeaks
@@ -71,7 +68,7 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
   ## create a matrix which could merged
   m <- .as.matrix.MassObjectList(l)
 
-  mass <- as.double(colnames(m))
+  mass <- attr(m, "mass")
 
   ## avoid named intensity/snr slot
   colnames(m) <- NULL
@@ -85,7 +82,7 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
   intensity <- fun(m, na.rm=TRUE)
 
   ## merge snr
-  for (i in seq(along=l)) {
+  for (i in seq_along(l)) {
     m[i, !isNA[i, ]] <- l[[i]]@snr
   }
   snr <- fun(m, na.rm=TRUE)
@@ -93,8 +90,7 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
   ## merge metaData
   metaData <- .mergeMetaData(lapply(l, function(x)x at metaData))
 
-  return(createMassPeaks(mass=mass, intensity=intensity, snr=snr,
-                         metaData=metaData))
+  createMassPeaks(mass=mass, intensity=intensity, snr=snr, metaData=metaData)
 }
 
 ## merge different metaData by equal list names
@@ -107,11 +103,11 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
 ##
 .mergeMetaData <- function(m) {
 
-  .flat <- function(x) {return(unname(unlist(x)))}
+  .flat <- function(x)unname(unlist(x))
 
   nm <- names(m[[1L]])
   names(nm) <- nm
-  m <- lapply(nm, function(n) {
+  lapply(nm, function(n) {
     cur <- m[[1L]][[n]]
     all <- lapply(m, function(x)x[[n]])
     len <- lapply(all, function(x)length(x))
@@ -126,6 +122,4 @@ mergeMassPeaks  <- function(l, labels, method=c("mean", "median", "sum"),
       return(cur)
     }
   })
-  return(m)
 }
-
diff --git a/R/metaData-methods.R b/R/metaData-methods.R
index b546141..5f0fe3d 100644
--- a/R/metaData-methods.R
+++ b/R/metaData-methods.R
@@ -21,7 +21,7 @@ setMethod(f="metaData",
           signature=signature(object="AbstractMassObject"),
           definition=function(object) {
 
-  return(object at metaData)
+  object at metaData
 })
 
 ## AbstractMassObject
@@ -30,6 +30,5 @@ setReplaceMethod(f="metaData",
                   definition=function(object, value) {
 
   object at metaData <- value
-  return(object)
+  object
 })
-
diff --git a/R/morphologicalFilter-functions.R b/R/morphologicalFilter-functions.R
index 09d8dc2..dd0992f 100644
--- a/R/morphologicalFilter-functions.R
+++ b/R/morphologicalFilter-functions.R
@@ -34,7 +34,7 @@
 ##  moving max
 ##
 .dilation <- function(x, halfWindowSize) {
-  return(.Call("C_dilation", x, halfWindowSize))
+  .Call("C_dilation", x, halfWindowSize)
 }
 
 ## erosion
@@ -55,6 +55,5 @@
 ##  moving min
 ##
 .erosion <- function(x, halfWindowSize) {
-  return(.Call("C_erosion", x, halfWindowSize))
+  .Call("C_erosion", x, halfWindowSize)
 }
-
diff --git a/R/msiSlices-functions.R b/R/msiSlices-functions.R
new file mode 100644
index 0000000..f75f60c
--- /dev/null
+++ b/R/msiSlices-functions.R
@@ -0,0 +1,67 @@
+## Copyright 2015 Sebastian Gibb
+## <mail at sebastiangibb.de>
+##
+## This file is part of MALDIquant for R and related languages.
+##
+## MALDIquant is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## MALDIquant is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
+
+## msiSlices
+##  create intensity matrix for each slice from a list of MassSpectrum/MassPeaks
+##  objects
+##
+## params:
+##  x: list of MassSpectrum/MassPeaks objects
+##  center: position(s) of interest (in mass values)
+##  tolerance: aggregate data around center +/- tolerance
+##  method: aggregate method
+##  adjust: set coordinates to 1,1 (if there are empty/missing spectra before)
+##
+## returns:
+##  an array (dim: x, y, z=slice nr)
+##
+msiSlices <- function(x, center, tolerance, method=c("sum", "mean", "median"),
+                      adjust=TRUE) {
+  x <- suppressWarnings(trim(x, range=range(center) + c(-tolerance, tolerance)))
+
+  .msiSlices(m=.as.matrix.MassObjectList(x),
+             coord=coordinates(x, adjust=adjust),
+             center=center, tolerance=tolerance, method=method)
+}
+
+.msiSlices <- function(m, coord, center, tolerance,
+                       method=c("sum", "mean", "median")) {
+  method <- match.arg(method)
+
+  fun <- switch(method,
+                "sum" = rowSums,
+                "mean" = rowMeans,
+                "median" = function(x, ...).colMedians(t(x), ...))
+
+  n <- unname(apply(coord, MARGIN=2L, FUN=max))
+
+  l <- pmin(findInterval(center - tolerance - .Machine$double.eps,
+                         attr(m, "mass")) + 1L, ncol(m))
+  r <- findInterval(center + tolerance + .Machine$double.eps, attr(m, "mass"))
+
+  slices <- array(NA, dim=c(x=n[1L], y=n[2L], z=length(center)))
+
+  for (i in seq_along(center)) {
+    slices[cbind(coord, i)] <- fun(m[, l[i]:r[i], drop=FALSE], na.rm=TRUE)
+  }
+
+  attr(slices, "center") <- center
+  attr(slices, "tolerance") <- tolerance
+  attr(slices, "method") <- method
+  slices
+}
diff --git a/R/plot-methods.R b/R/plot-methods.R
index a39a20c..fcf3ca9 100644
--- a/R/plot-methods.R
+++ b/R/plot-methods.R
@@ -33,7 +33,8 @@ setMethod(f="plot",
                               abline.col="#808080", ...) {
 
   if (all(sub == x at metaData$file) && length(x at metaData$file) > 1L) {
-    sub <- paste0(ifelse(isMassSpectrum(x), "averaged spectrum", "merged peaks"),
+    sub <- paste0(ifelse(isMassSpectrum(x),
+                         "averaged spectrum", "merged peaks"),
                   " composed of ", length(x at metaData$file), " ",
                   ifelse(isMassSpectrum(x), "MassSpectrum", "MassPeaks"),
                   " objects")
@@ -44,4 +45,3 @@ setMethod(f="plot",
        col.sub=col.sub, ...)
   abline(h=0L, col=abline.col)
 })
-
diff --git a/R/plotImsSlice-functions.R b/R/plotImsSlice-functions.R
deleted file mode 100644
index af5b699..0000000
--- a/R/plotImsSlice-functions.R
+++ /dev/null
@@ -1,103 +0,0 @@
-## Copyright 2014 Sebastian Gibb
-## <mail at sebastiangibb.de>
-##
-## This file is part of MALDIquant for R and related languages.
-##
-## MALDIquant is free software: you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## MALDIquant is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
-
-## plotImsSlice
-##  plot IMS slice from a list of MassSpectrum/MassPeaks objects
-##
-## params:
-##  x: list of MassSpectrum/MassPeaks objects
-##  range: double, length == 2, range/thickness of the slice
-##  sub: sub-title
-##  removeEmptyRows: logical, Should empty rows be removed?
-##  removeEmptyCols: logical, Should empty cols be removed?
-##  colRamp: colours as colorRamp function
-##  interpolate: logical, see rasterImage for details
-##  ...: passed to plot
-##
-plotImsSlice <- function(x, range=c(0, Inf),
-                         sub=paste0("m/z: ", range[1L], "-", range[2L], ""),
-                         removeEmptyRows=TRUE,
-                         removeEmptyCols=TRUE,
-                         colRamp=colorRamp(c("black", "blue", "green",
-                                             "yellow", "red")),
-                         interpolate=FALSE, ...) {
-
-  m <- .prepareImsSlice(x = x, range = range)
-
-  if (removeEmptyRows) {
-    kr <- rowSums(is.na(m)) != ncol(m)
-    m <- m[kr, ]
-    nr <- nrow(m)
-  }
-  if (removeEmptyCols) {
-    kc <- colSums(is.na(m)) != nrow(m)
-    m <- m[, kc]
-    nc <- ncol(m)
-  }
-
-  ## create color raster
-  isNotNA <- which(!is.na(m))
-  m[isNotNA] <- rgb(colRamp(m[isNotNA]), maxColorValue=255L)
-
-  ## prepare plot area
-  plot(NA, type="n", xlim=c(1L, nc), ylim=c(1L, nr), axes=FALSE, asp=1L,
-       xlab="", ylab="", sub=sub, ...)
-  ## plot image
-  rasterImage(as.raster(m), xleft=1L, xright=nc, ybottom=1L, ytop=nr,
-              interpolate=interpolate)
-}
-
-## .prepareImsSlice
-##  create intensity matrix for a slice from a list of MassSpectrum/MassPeaks
-##  objects
-##
-## params:
-##  x: list of MassSpectrum/MassPeaks objects
-##  range: double, length == 2, range/thickness of the slice
-##
-.prepareImsSlice <- function(x, range) {
-
-  .stopIfNotIsMassObjectList(x)
-
-  ## display only mass in range
-  suppressWarnings(x <- trim(x, range=range))
-
-  ## find x and y positions
-  pos <- lapply(x, function(y)metaData(y)$imaging$pos)
-  pos <- do.call(rbind, pos)
-
-  if (is.null(pos)) {
-    stop("The spectra do not have any position information.")
-  }
-
-  ## max x/y to build image matrix
-  nc <- max(pos[, "x"])
-  nr <- max(pos[, "y"])
-
-  ## init matrix
-  m <- matrix(NA, nrow=nr, ncol=nc)
-
-  ## fill matrix with intensity values
-  for (i in seq(along=x)) {
-    m[pos[i, "y"], pos[i, "x"]] <- sum(intensity(x[[i]]), na.rm=TRUE)
-  }
-
-  ## scale matrix (better contrast)
-  m/max(m, na.rm=TRUE)
-}
-
diff --git a/R/plotMsiSlice-functions.R b/R/plotMsiSlice-functions.R
new file mode 100644
index 0000000..3e6c715
--- /dev/null
+++ b/R/plotMsiSlice-functions.R
@@ -0,0 +1,139 @@
+## Copyright 2014-2015 Sebastian Gibb
+## <mail at sebastiangibb.de>
+##
+## This file is part of MALDIquant for R and related languages.
+##
+## MALDIquant is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## MALDIquant is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
+
+.plotMsiSlice <- function(x, center=attr(x, "center"),
+                          tolerance=attr(x, "tolerance"),
+                          colRampList=list(colorRamp(c("black", "blue", "green",
+                                                       "yellow", "red"))),
+                          xlab="", ylab="", interpolate=FALSE, scale=TRUE,
+                          legend=scale, alignLabels=FALSE, label.cex=0.75,
+                          label.col=NULL, ...) {
+  stopifnot(is.array(x))
+
+  d <- dim(x)
+  tolerance <- rep_len(tolerance, length(center))
+
+  xlim <- c(0L, d[1L] + (2L * d[3L] * legend))
+  ylim <- c(0L, d[2L])
+
+  ## prepare plot area
+  plot(NA, type="n", xlim=xlim, ylim=ylim,
+       axes=FALSE, xlab=xlab, ylab=ylab, asp=1L, ...)
+
+  if (d[3L] > 1L) {
+    col <- x
+
+    for (i in seq_len(d[3L])) {
+      col[,, i] <- .colorMatrix(.array2matrix(x), colRamp=colRampList[[i]],
+                                scale=scale)
+    }
+
+    x <- .combineColorMatrices(x, col)
+  } else {
+    x <- .colorMatrix(.array2matrix(x), colRamp=colRampList[[1L]], scale=scale)
+  }
+
+  ## plot image
+  .rasterSlice(x, interpolate=interpolate)
+
+  if (legend) {
+
+    if (!is.null(center)) {
+      labels <- .mapply(function(cnt, tol)bquote(.(cnt) %+-% .(tol)),
+                        cnt=center, tol=tolerance)
+      strh <- max(strheight(labels, cex=label.cex)) * 1.2
+    } else {
+      labels <- character(d[3L])
+      strh <- 0L
+    }
+
+    xleft <- xlim[2L] - seq(from=d[3L] * 2L - 1L, to=1L, by=-2L)
+    xright <- xleft + 1L
+    ybottom <- rep.int(d[3L] * strh, d[3L])
+    ytext <- (d[3L] - 1L):0L * strh
+
+    xtext <- if (alignLabels) {
+      rep.int(xlim[2L], 3L)
+    } else {
+      xright
+    }
+
+    if (is.null(label.col) && d[3L] == 1L) {
+      label.col <- "black"
+    } else if (is.null(label.col) && d[3L] > 1L) {
+      label.col <- lapply(colRampList, function(x).rgb(x(1L)))
+    }
+
+    for (i in seq_len(d[3L])) {
+      .msiLegend(xleft=xleft[i], xright=xright[i],
+                 ybottom=ybottom[1L], ytop=ylim[2L],
+                 colRamp=colRampList[[i]], interpolate=interpolate)
+      text(x=xtext[i], y=ytext[i], labels=as.expression(labels[i]),
+           col=label.col[[i]], cex=label.cex, adj=c(1L, 0L))
+    }
+  }
+}
+
+.rasterSlice <- function(x, interpolate=FALSE) {
+  rasterImage(as.raster(t(x)),
+              xleft=0L, xright=nrow(x), ybottom=0L, ytop=ncol(x),
+              interpolate=interpolate)
+}
+
+.array2matrix <- function(a, z=1L) {
+## subset function that preserves a matrix even if x or y 1
+## ([,,drop=TRUE]) creates a vector
+  d <- dim(a)
+  matrix(a[,, z, drop=TRUE], nrow=d[1L], ncol=d[2L])
+}
+
+.msiLegend <- function(xleft, xright, ybottom, ytop,
+                       colRamp=colorRamp(c("black", "blue", "green", "yellow",
+                                           "red")), interpolate=FALSE) {
+  gradient <- matrix(.rgb(colRamp(seq.int(1L, 0L, length.out=100L))),
+                     ncol=1L)
+  rect(xleft=xleft, xright=xright, ybottom=ybottom, ytop=ytop,
+       col="black")
+  rasterImage(as.raster(gradient),
+              xleft=xleft, xright=xright, ybottom=ybottom, ytop=ytop,
+              interpolate=interpolate)
+}
+
+.colorMatrix <- function(x, colRamp, scale=TRUE) {
+  if (scale) {
+    x <- x / max(x, na.rm=TRUE)
+  }
+
+  notNA <- which(!is.na(x))
+  x[notNA] <- .rgb(colRamp(x[notNA]))
+  x
+}
+
+.combineColorMatrices <- function(x, col) {
+  i <- apply(x, 2L, max.col, ties.method="first")
+  j <- cbind(x=rep.int(seq_len(nrow(x)), ncol(x)),
+             y=rep(seq_len(ncol(x)), each=nrow(x)),
+             z=as.vector(i))
+  y <- .array2matrix(col)
+  y[] <- col[j]
+  y
+}
+
+.rgb <- function(x) {
+  rgb(x, maxColorValue=255L)
+}
diff --git a/R/plotMsiSlice-methods.R b/R/plotMsiSlice-methods.R
new file mode 100644
index 0000000..0a52598
--- /dev/null
+++ b/R/plotMsiSlice-methods.R
@@ -0,0 +1,91 @@
+## Copyright 2015 Sebastian Gibb
+## <mail at sebastiangibb.de>
+##
+## This file is part of MALDIquant for R and related languages.
+##
+## MALDIquant is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## MALDIquant is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with MALDIquant. If not, see <http://www.gnu.org/licenses/>
+
+setMethod(f="plotMsiSlice",
+          signature=signature(x="list"),
+          definition=function(x, center, tolerance,
+                              colRamp=colorRamp(c("black", "blue", "green",
+                                                   "yellow", "red")),
+                              interpolate=FALSE, legend=TRUE, alignLabels=FALSE,
+                              combine=FALSE, ...) {
+  .stopIfNotIsMassObjectList(x)
+  slides <- msiSlices(x, center=center, tolerance=tolerance)
+  plotMsiSlice(slides, colRamp=colRamp, interpolate=interpolate, legend=legend,
+               alignLabels=alignLabels, combine=combine, ...)
+})
+
+setMethod(f="plotMsiSlice",
+          signature=signature(x="array"),
+          definition=function(x, colRamp=colorRamp(c("black", "blue", "green",
+                                                     "yellow", "red")),
+                              interpolate=FALSE, legend=TRUE, alignLabels=FALSE,
+                              combine=FALSE, plotInteractive=FALSE, ...) {
+  n <- dim(x)[3L]
+
+  if (!is.list(colRamp)) {
+    colRamp <- rep_len(list(colRamp), n)
+  }
+
+  if (n != length(colRamp)) {
+    stop(sQuote("dim(x)[3L]"), " (number of centers) has to be the same as ",
+         "the length of the list ", sQuote("colRamp"), "!\n",
+         "See ", sQuote("?plotMsiSlice"), " for details.")
+  }
+
+  if (combine) {
+   .plotMsiSlice(x, colRampList=colRamp, interpolate=interpolate,
+                  legend=legend, alignLabels=alignLabels, ...)
+
+  } else {
+    if (n > 1L && dev.interactive() && !plotInteractive) {
+      warning(sQuote("plotMsiSlice"), " was called for multiple slice on an ",
+              "interactive device. Only the first slice is plotted. Use ",
+              sQuote("pdf"), " or a similar device to plot all slices at once.",
+              " Alternatively use ", dQuote("combine=TRUE"), " to plot ",
+              "multiple centers in one plot.\n",
+              "See ", sQuote("?plotMsiSlice"), " for details.")
+      n <- 1L
+    }
+
+    tolerance <- rep_len(attr(x, "tolerance"), n)
+
+    for (i in seq_len(n)) {
+      .plotMsiSlice(x[,, i, drop=FALSE],
+                    center=attr(x, "center")[i],
+                    tolerance=tolerance[i],
+                    colRampList=colRamp[i], interpolate=interpolate,
+                    legend=legend, ...)
+    }
+  }
+})
+
+setMethod(f="plotMsiSlice",
+          signature=signature(x="matrix"),
+          definition=function(x, colRamp=colorRamp(c("black", "blue", "green",
+                                                     "yellow", "red")),
+                                interpolate=FALSE, scale=TRUE, legend=scale,
+                                ...) {
+  if (!is.list(colRamp)) {
+    colRamp <- list(colRamp)
+  }
+
+  dim(x) <- c(dim(x), 1L)
+
+  .plotMsiSlice(x, colRamp=colRamp, interpolate=interpolate, scale=scale,
+                legend=legend, ...)
+})
diff --git a/R/points-methods.R b/R/points-methods.R
index aabb680..ab9ea25 100644
--- a/R/points-methods.R
+++ b/R/points-methods.R
@@ -23,4 +23,3 @@ setMethod(f="points",
 
   points(x=x at mass, y=x at intensity, ...)
 })
-
diff --git a/R/range-functions.R b/R/range-functions.R
index 0a7473f..9867e41 100644
--- a/R/range-functions.R
+++ b/R/range-functions.R
@@ -1,4 +1,4 @@
-## Copyright 2013 Sebastian Gibb
+## Copyright 2013-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -42,7 +42,7 @@
   }
 
   ## no overlap
-  return(c(0L, 0L))
+  c(0L, 0L)
 }
 
 ## .reorderRange
@@ -60,5 +60,5 @@
     x <- x[2L:1L]
   }
 
-  return(x)
+  x
 }
diff --git a/R/referencePeaks-functions.R b/R/referencePeaks-functions.R
index 0169881..38e29f7 100644
--- a/R/referencePeaks-functions.R
+++ b/R/referencePeaks-functions.R
@@ -45,6 +45,5 @@ referencePeaks <- function(l, method=c("strict", "relaxed"), minFrequency=0.9,
   ## set peak intensity to number of occurrence
   intensity <- unname(colMeans(m))
 
-  return(createMassPeaks(mass=as.double(colnames(m)), intensity=intensity))
+  createMassPeaks(mass=attr(m, "mass"), intensity=intensity)
 }
-
diff --git a/R/removeBaseline-methods.R b/R/removeBaseline-methods.R
index 85ebd78..ee5f501 100644
--- a/R/removeBaseline-methods.R
+++ b/R/removeBaseline-methods.R
@@ -23,19 +23,19 @@ setMethod(f="removeBaseline",
                               method=c("SNIP", "TopHat", "ConvexHull",
                                        "median"),
                               ...) {
-
   ## empty spectrum?
   if (.isEmptyWarning(object)) {
     return(object)
   }
 
   ## estimate baseline
-  baseline <- estimateBaseline(object=object, method=method, ...)
+  baseline <- .estimateBaseline(x=object at mass, y=object at intensity,
+                                method=method, ...)
 
   ## substract baseline
-  object at intensity <- object at intensity - baseline[, 2L]
+  object at intensity <- object at intensity - baseline
 
-  return(object)
+  object
 })
 
 ## list
@@ -46,6 +46,5 @@ setMethod(f="removeBaseline",
   ## test arguments
   .stopIfNotIsMassSpectrumList(object)
 
-  return(.mapply(removeBaseline, object, ...))
+  .mapply(removeBaseline, object, ...)
 })
-
diff --git a/R/removeEmptyMassObjects-functions.R b/R/removeEmptyMassObjects-functions.R
index db57096..5dc03e3 100644
--- a/R/removeEmptyMassObjects-functions.R
+++ b/R/removeEmptyMassObjects-functions.R
@@ -30,8 +30,8 @@ removeEmptyMassObjects <- function(l) {
   .stopIfNotIsMassObjectList(l)
 
   ## find empty MassPeaks objects
-  notEmpty <- !(1L:length(l) %in% findEmptyMassObjects(l))
+  notEmpty <- !(seq_along(l) %in% findEmptyMassObjects(l))
 
   ## exclude empty elements
-  return(l[notEmpty])
+  l[notEmpty]
 }
diff --git a/R/replaceNegativeIntensityValues-functions.R b/R/replaceNegativeIntensityValues-functions.R
index dd924e7..0c9e394 100644
--- a/R/replaceNegativeIntensityValues-functions.R
+++ b/R/replaceNegativeIntensityValues-functions.R
@@ -27,11 +27,11 @@
 ##  a AbstractMass object
 ##
 .replaceNegativeIntensityValues <- function(object, warn=TRUE) {
-  if (!isEmpty(object) && any(object at intensity < 0L)) {
+  if (any(object at intensity < 0L, na.rm=TRUE) && !isEmpty(object)) {
     if (warn) {
       warning("Negative intensity values are replaced by zeros.")
     }
     object at intensity[which(object at intensity < 0L)] <- 0L
   }
-  return(object)
+  object
 }
diff --git a/R/show-functions.R b/R/show-functions.R
index d615405..1dcb4f5 100644
--- a/R/show-functions.R
+++ b/R/show-functions.R
@@ -30,13 +30,12 @@
     n <- length(x)
 
     if (n > 1L) {
-      name <- paste0(name, 1L:n)
+      name <- paste0(name, seq_len(n))
     }
 
   } else {
     name <- NULL
   }
 
-  return(name)
+  name
 }
-
diff --git a/R/show-methods.R b/R/show-methods.R
index 4184989..8d5f1ac 100644
--- a/R/show-methods.R
+++ b/R/show-methods.R
@@ -65,7 +65,7 @@ setMethod(f=".prepareShow",
   groups <- c(groups, .prepareShowGroupName(object at metaData$file, "File"))
   values <- c(values, object at metaData$file)
 
-  return(list(groups=groups, values=values))
+  list(groups=groups, values=values)
 })
 
 setMethod(f=".prepareShow",
@@ -86,6 +86,5 @@ setMethod(f=".prepareShow",
   l$groups <- append(l$groups, groups, after=4L)
   l$values <- append(l$values, values, after=4L)
 
-  return(list(groups=l$groups, values=l$values))
+  list(groups=l$groups, values=l$values)
 })
-
diff --git a/R/smoothIntensity-methods.R b/R/smoothIntensity-methods.R
index e313fbf..d219491 100644
--- a/R/smoothIntensity-methods.R
+++ b/R/smoothIntensity-methods.R
@@ -29,26 +29,22 @@ setMethod(f="smoothIntensity",
 
   method <- match.arg(method)
 
-  switch(method,
-         "SavitzkyGolay" = {
-           fun <- .savitzkyGolay
-           if (missing(halfWindowSize)) {
-             halfWindowSize <- 10L
-           }
-         },
-         "MovingAverage" = {
-           fun <- .movingAverage
-           if (missing(halfWindowSize)) {
-             halfWindowSize <- 2L
-           }
-         },
-         {
-           stop("Unknown ", sQuote("method"), ".")
-         }
+  fun <- switch(method,
+                "SavitzkyGolay" = {
+                  if (missing(halfWindowSize)) {
+                    halfWindowSize <- 10L
+                  }
+                  .savitzkyGolay
+                },
+                "MovingAverage" = {
+                  if (missing(halfWindowSize)) {
+                    halfWindowSize <- 2L
+                  }
+                  .movingAverage
+                }
   )
 
-  return(.transformIntensity(object, fun=fun,
-                             halfWindowSize=halfWindowSize, ...))
+  .transformIntensity(object, fun=fun, halfWindowSize=halfWindowSize, ...)
 })
 
 ## list
@@ -59,6 +55,5 @@ setMethod(f="smoothIntensity",
   ## test arguments
   .stopIfNotIsMassSpectrumList(object)
 
-  return(.mapply(smoothIntensity, object, ...))
+  .mapply(smoothIntensity, object, ...)
 })
-
diff --git a/R/smoothingFilters-functions.R b/R/smoothingFilters-functions.R
index 57069f6..3263673 100644
--- a/R/smoothingFilters-functions.R
+++ b/R/smoothingFilters-functions.R
@@ -29,9 +29,9 @@
 ##
 .movingAverage <- function(y, halfWindowSize=2L) {
   .stopIfNotIsValidHalfWindowSize(halfWindowSize, n=length(y))
-  windowSize <- 2L*halfWindowSize+1L
-  return(.filter(y, hws=halfWindowSize,
-                 coef=matrix(1L/windowSize, nrow=windowSize, ncol=windowSize)))
+  windowSize <- 2L * halfWindowSize + 1L
+  .filter(y, hws=halfWindowSize,
+          coef=matrix(1L / windowSize, nrow=windowSize, ncol=windowSize))
 }
 
 ## .savitzkyGolay
@@ -51,14 +51,13 @@
 .savitzkyGolay <- function(y, halfWindowSize=10L, polynomialOrder=3L) {
   .stopIfNotIsValidHalfWindowSize(halfWindowSize, n=length(y))
 
-  windowSize <- 2L*halfWindowSize+1L
+  windowSize <- 2L * halfWindowSize + 1L
 
   if (windowSize < polynomialOrder) {
     stop("The window size has to be larger than the polynomial order.")
   }
-  return(.filter(y, hws=halfWindowSize,
-                 coef=.savitzkyGolayCoefficients(m=halfWindowSize,
-                                                 k=polynomialOrder)))
+  .filter(y, hws=halfWindowSize,
+          coef=.savitzkyGolayCoefficients(m=halfWindowSize, k=polynomialOrder))
 }
 
 ## .savitzkyGolayCoefficients
@@ -80,7 +79,7 @@
 ##  k: integer, polynomial order (k == 0 = moving average)
 .savitzkyGolayCoefficients <- function(m, k=3L) {
   k <- 0L:k
-  nm <- 2L*m+1L
+  nm <- 2L * m + 1L
   nk <- length(k)
   K <- matrix(k, nrow=nm, ncol=nk, byrow=TRUE)
 
@@ -94,29 +93,28 @@
   ## row m+1 == typical sg coef
   ## row (n-m-1):n == rhs coef
   F <- matrix(double(), nrow=nm, ncol=nm)
-  for (i in 1L:(m+1L)) {
-    M <- matrix((1L:nm)-i, nrow=nm, ncol=nk, byrow=FALSE)
+  for (i in seq_len(m + 1L)) {
+    M <- matrix(seq_len(nm) - i, nrow=nm, ncol=nk, byrow=FALSE)
     X <- M^K
     T <- solve(t(X) %*% X) %*% t(X)
     F[i, ] <- T[1L, ]
   }
   ## rhs (row (n-m):n) are equal to reversed lhs
-  F[(m+2L):nm, ] <- rev(F[1L:m, ])
+  F[(m + 2L):nm, ] <- rev(F[seq_len(m), ])
 
-  return(F)
+  F
 }
 
 ## .filter
 ##  remove time series attributes and NA at left/right extrema
 .filter <- function(x, hws, coef) {
   n <- length(x)
-  w <- 2L*hws+1L
-  y <- stats::filter(x=x, filter=coef[hws+1L, ], sides=2L)
+  w <- 2L * hws + 1L
+  y <- stats::filter(x=x, filter=coef[hws + 1L, ], sides=2L)
   attributes(y) <- NULL
 
   ## fix left/right extrema
-  y[1L:hws] <- head(coef, hws) %*% head(x, w)
-  y[(n-hws+1L):n] <- tail(coef, hws) %*% tail(x, w)
-  return(y)
+  y[seq_len(hws)] <- head(coef, hws) %*% head(x, w)
+  y[(n - hws + 1L):n] <- tail(coef, hws) %*% tail(x, w)
+  y
 }
-
diff --git a/R/snr-methods.R b/R/snr-methods.R
index a79e043..9f4e248 100644
--- a/R/snr-methods.R
+++ b/R/snr-methods.R
@@ -21,6 +21,5 @@ setMethod(f="snr",
           signature=signature(object="MassPeaks"),
           definition=function(object) {
 
-  return(object at snr)
+  object at snr
 })
-
diff --git a/R/subset-methods.R b/R/subset-methods.R
index a33f126..cb5a163 100644
--- a/R/subset-methods.R
+++ b/R/subset-methods.R
@@ -24,7 +24,7 @@ setMethod(f="[",
   x at mass <- x at mass[i]
   x at intensity <- x at intensity[i]
 
-  return(x)
+  x
 })
 
 ## AbstractMassObject
@@ -37,7 +37,7 @@ setMethod(f="[",
   x at mass <- x at mass[i]
   x at intensity <- x at intensity[i]
 
-  return(x)
+  x
 })
 
 setMethod(f="[",
@@ -48,7 +48,7 @@ setMethod(f="[",
   x at intensity <- x at intensity[i]
   x at snr <- x at snr[i]
 
-  return(x)
+  x
 })
 
 ## AbstractMassObject
@@ -62,6 +62,5 @@ setMethod(f="[",
   x at intensity <- x at intensity[i]
   x at snr <- x at snr[i]
 
-  return(x)
+  x
 })
-
diff --git a/R/textLabelRects-functions.R b/R/textLabelRects-functions.R
index 89b5bd2..65bc56a 100644
--- a/R/textLabelRects-functions.R
+++ b/R/textLabelRects-functions.R
@@ -31,15 +31,16 @@
 ##  a matrix of coordinates
 ##
 .textLabelRects <- function(x, y, text, adj, cex, offset=c(0.0, 0.2)) {
-  return(t(mapply(function(xc, yc, t) {
+  t(mapply(function(xc, yc, t) {
     w <- strwidth(t, cex=cex)
     h <- strheight(t, cex=cex)
     ## extra calculation of offsets to be independend of adj
-    woffset <- w*offset[1L]
-    hoffset <- h*offset[2L]
-    return(c(x0=xc-w*adj[1L]-woffset, y0=yc-h*adj[2L]-hoffset,
-             x1=xc+w*(1L-adj[1L])+woffset, y1=yc+h*(1L-adj[2L])+hoffset,
+    woffset <- w * offset[1L]
+    hoffset <- h * offset[2L]
+    return(c(x0=xc - w * adj[1L] - woffset,
+             y0=yc - h * adj[2L] - hoffset,
+             x1=xc + w * (1L - adj[1L]) + woffset,
+             y1=yc + h * (1L - adj[2L]) + hoffset,
              x=xc, y=yc, w=w, h=h))
-  }, xc=x, yc=y, t=text)))
+  }, xc=x, yc=y, t=text))
 }
-
diff --git a/R/totalIonCurrent-methods.R b/R/totalIonCurrent-methods.R
index 1a137d0..e0c9a87 100644
--- a/R/totalIonCurrent-methods.R
+++ b/R/totalIonCurrent-methods.R
@@ -24,6 +24,5 @@ setMethod(f="totalIonCurrent",
   left <- as.double(head(object at intensity, -1L))
   right <- as.double(tail(object at intensity, -1L))
 
-  return(as.double(sum((left+right)/2*diff(object at mass), na.rm=TRUE)))
+  as.double(sum((left + right) / 2L * diff(object at mass), na.rm=TRUE))
 })
-
diff --git a/R/transformIntensity-methods.R b/R/transformIntensity-methods.R
index 97bfe16..5927494 100644
--- a/R/transformIntensity-methods.R
+++ b/R/transformIntensity-methods.R
@@ -41,13 +41,10 @@ setMethod(f="transformIntensity",
          },
          "log10" = {
            log10
-         },
-         {
-           stop("Unknown ", sQuote("method"), ".")
          }
   )
 
-  return(.transformIntensity(object, fun=fun))
+  .transformIntensity(object, fun=fun)
 })
 
 ## AbstractMassObject
@@ -60,21 +57,16 @@ setMethod(f=".transformIntensity",
 
     object at intensity <- fun(object at intensity, ...)
 
-    belowZeroIdx <- which(object at intensity < 0L)
-
-    if (length(belowZeroIdx)) {
-      warning("Negative intensities generated. Replaced by zeros.")
-      object <- .replaceNegativeIntensityValues(object, warn=FALSE)
-    }
-
     if (na.rm) {
       naIdx <- which(!is.na(object at intensity))
       object at intensity <- object at intensity[naIdx]
       object at mass <- object at mass[naIdx]
     }
+
+    object <- .replaceNegativeIntensityValues(object)
   }
 
-  return(object)
+  object
 })
 
 ## list
@@ -86,7 +78,7 @@ setMethod(f="transformIntensity",
   ## test arguments
   .stopIfNotIsMassObjectList(object)
 
-  return(lapply(object, transformIntensity, ...))
+  .lapply(object, transformIntensity, ...)
 })
 
 ## list
@@ -97,6 +89,5 @@ setMethod(f=".transformIntensity",
   ## test arguments
   .stopIfNotIsMassObjectList(object)
 
-  return(lapply(object, .transformIntensity, ...))
+  .lapply(object, .transformIntensity, ...)
 })
-
diff --git a/R/trim-methods.R b/R/trim-methods.R
index 2395b6d..951154c 100644
--- a/R/trim-methods.R
+++ b/R/trim-methods.R
@@ -1,4 +1,4 @@
-## Copyright 2012-2013 Sebastian Gibb
+## Copyright 2012-2015 Sebastian Gibb
 ## <mail at sebastiangibb.de>
 ##
 ## This file is part of MALDIquant for R and related languages.
@@ -26,32 +26,31 @@ setMethod("trim",
 
   range <- .reorderRange(range)
 
-  sel <- which(range[1L] <= object at mass & object at mass <= range[2L])
+  sel <- which(findInterval(object at mass, range, rightmost.closed=TRUE) == 1L)
 
   if (!length(sel)) {
     warning("The mass range (", paste0(range, collapse=":"),
             ") is outside of the stored mass values. No data points left.")
   }
 
-  return(object[sel])
+  object[sel]
 })
 
 ## list
 setMethod("trim",
           signature=signature(object="list", range="numeric"),
-          definition=function(object, range) {
-  return(lapply(X=object, FUN=trim, range=range))
+          definition=function(object, range, ...) {
+  .lapply(X=object, FUN=trim, range=range, ...)
 })
 
 setMethod("trim",
           signature=signature(object="list", range="missing"),
-          definition=function(object) {
+          definition=function(object, ...) {
   range <- .overlap(object)
 
   if (all(range == 0L)) {
     stop("No overlap found!")
   }
 
-  return(lapply(X=object, FUN=trim, range=range))
+  .lapply(X=object, FUN=trim, range=range, ...)
 })
-
diff --git a/R/unlist-functions.R b/R/unlist-functions.R
index da041b6..f4d18c7 100644
--- a/R/unlist-functions.R
+++ b/R/unlist-functions.R
@@ -28,4 +28,3 @@
 .unlist <- function(x) {
   unlist(x, recursive=FALSE, use.names=FALSE)
 }
-
diff --git a/R/valid-methods.R b/R/valid-methods.R
index 5db182c..5a2725c 100644
--- a/R/valid-methods.R
+++ b/R/valid-methods.R
@@ -33,7 +33,7 @@
       any(object at intensity < 0L)) {
     warning("Negative intensity values found.")
   }
-  return(TRUE)
+  TRUE
 }
 
 setValidity("AbstractMassObject", method=.validAbstractMassObject)
@@ -41,11 +41,10 @@ setValidity("AbstractMassObject", method=.validAbstractMassObject)
 .validMassPeaks <- function(object) {
   if (length(object at intensity) != length(object at snr)) {
     return(paste0("Lengths of intensity (", length(object at intensity),
-                  ") and snr(", length(object at snr),
+                  ") and snr (", length(object at snr),
                   ") have to be equal."))
   }
-  return(.validAbstractMassObject(object))
+  .validAbstractMassObject(object)
 }
 
 setValidity("MassPeaks", method=.validMassPeaks)
-
diff --git a/R/warp-functions.R b/R/warp-functions.R
index 991f661..8b51edd 100644
--- a/R/warp-functions.R
+++ b/R/warp-functions.R
@@ -27,12 +27,10 @@
 ##  a list of warped MassSpectrum objects
 ##
 warpMassSpectra <- function(l, w) {
-
-  ## test parameters
   .stopIfNotIsMassSpectrumList(l)
   .stopIfNotIsFunctionList(w)
 
-  return(.warp(l, w))
+  .warp(l, w)
 }
 
 ## warpMassPeaks
@@ -46,12 +44,10 @@ warpMassSpectra <- function(l, w) {
 ##  a list of warped MassPeaks objects
 ##
 warpMassPeaks <- function(l, w) {
-
-  ## test parameters
   .stopIfNotIsMassPeaksList(l)
   .stopIfNotIsFunctionList(w)
 
-  return(.warp(l, w))
+  .warp(l, w)
 }
 
 
@@ -66,9 +62,8 @@ warpMassPeaks <- function(l, w) {
 ##  a list of warped AbstractMassObject objects
 ##
 .warp <- function(l, w) {
-  return(mapply(function(m, wf) {
-           m at mass <- m at mass+wf(m at mass)
-           return(m)
-         }, m=l, wf=w, SIMPLIFY=FALSE))
+  .mapply(function(m, wf) {
+           m at mass <- m at mass + wf(m at mass)
+           m
+  }, m=l, wf=w)
 }
-
diff --git a/R/warpingFunction-functions.R b/R/warpingFunction-functions.R
index fd6ce53..f049a43 100644
--- a/R/warpingFunction-functions.R
+++ b/R/warpingFunction-functions.R
@@ -36,7 +36,7 @@
 ##
 .warpingFunctionLowess <- function(x, d, ...) {
   lo <- lowess(x=x, y=d, ...)
-  return(approxfun(x=lo$x, y=lo$y, rule=2L))
+  approxfun(x=lo$x, y=lo$y, rule=2L)
 }
 
 ## .warpingFunctionLinear
@@ -53,7 +53,7 @@
 .warpingFunctionLinear <- function(x, d, ...) {
   l <- lm(y ~ x1, data=list(x1=x, y=d), ...)
   co <- coef(l)
-  return(function(x) { return (co[1L]+x*co[2L]) })
+  function(x) { co[1L]+x*co[2L] }
 }
 
 ## .warpingFunctionQuadratic
@@ -70,7 +70,7 @@
 .warpingFunctionQuadratic <- function(x, d, ...) {
   l <- lm(y ~ x1+x2, data=list(x1=x, x2=x*x, y=d), ...)
   co <- coef(l)
-  return(function(x) { return (co[1L]+x*co[2L]+x*x*co[3L]) })
+  function(x) { co[1L]+x*co[2L]+x*x*co[3L] }
 }
 
 ## .warpingFunctionCubic
@@ -87,6 +87,5 @@
 .warpingFunctionCubic <- function(x, d, ...) {
   l <- lm(y ~ x1+x2+x3, data=list(x1=x, x2=x*x, x3=x*x*x, y=d), ...)
   co <- coef(l)
-  return(function(x) { return (co[1L]+x*co[2L]+x*x*co[3L]+x*x*x*co[4L]) })
+  function(x) { co[1L]+x*co[2L]+x*x*co[3L]+x*x*x*co[4L] }
 }
-
diff --git a/R/which.closest-functions.R b/R/which.closest-functions.R
index 9595da5..92ae938 100644
--- a/R/which.closest-functions.R
+++ b/R/which.closest-functions.R
@@ -30,16 +30,15 @@
 
   ## find left interval
   lIdx <- findInterval(x, vec, rightmost.closed=FALSE, all.inside=TRUE)
-  rIdx <- lIdx+1L
+  rIdx <- lIdx + 1L
 
   ## respect limits
   lIdx[which(lIdx < 1L)] <- 1L
   rIdx[which(rIdx > length(vec))] <- length(vec)
 
   ## calculate differences for left and right
-  lDiff <- abs(vec[lIdx]-x)
-  rDiff <- abs(vec[rIdx]-x)
+  lDiff <- abs(vec[lIdx] - x)
+  rDiff <- abs(vec[rIdx] - x)
 
-  return(ifelse(rDiff == pmin.int(lDiff, rDiff), rIdx, lIdx))
+  ifelse(rDiff == pmin.int(lDiff, rDiff), rIdx, lIdx)
 }
-
diff --git a/build/vignette.rds b/build/vignette.rds
index 74d363e..8bae807 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/demo/baseline.R b/demo/baseline.R
index e21fe74..71eff91 100644
--- a/demo/baseline.R
+++ b/demo/baseline.R
@@ -31,4 +31,3 @@ lines(bConvexHull, lwd=2, col=2)
 bMedian <- estimateBaseline(s, method="median")
 plot(s, main="Median Baseline")
 lines(bMedian, lwd=2, col=2)
-
diff --git a/inst/doc/MALDIquant-intro.pdf b/inst/doc/MALDIquant-intro.pdf
index efa4b1c..481d66f 100644
Binary files a/inst/doc/MALDIquant-intro.pdf and b/inst/doc/MALDIquant-intro.pdf differ
diff --git a/man/AbstractMassObject-class.Rd b/man/AbstractMassObject-class.Rd
index b9ecb3c..f6a1d38 100644
--- a/man/AbstractMassObject-class.Rd
+++ b/man/AbstractMassObject-class.Rd
@@ -23,6 +23,13 @@
 \alias{metaData<-}
 \alias{metaData,AbstractMassObject-method}
 \alias{metaData<-,AbstractMassObject-method}
+\alias{coordinates}
+\alias{coordinates<-}
+\alias{coordinates,AbstractMassObject-method}
+\alias{coordinates<-,AbstractMassObject,numeric-method}
+\alias{coordinates<-,AbstractMassObject,matrix-method}
+\alias{coordinates,list-method}
+\alias{coordinates<-,list,matrix-method}
 \alias{points,AbstractMassObject-method}
 
 \title{Class "AbstractMassObject"}
@@ -53,6 +60,13 @@ It shouldn't create or handle by the user because it is for internal use only.
   \item{as.matrix}{\code{signature(x = "AbstractMassObject")}:
     Converts an \code{\linkS4class{AbstractMassObject}} object to a
     matrix with 2 columns (\code{mass}, \code{intensity}).}
+  \item{coordinates}{\code{signature(object = "AbstractMassObject")}:
+    Accessor function for coordinates stored in object generated from imaging
+    mass spectrometry data.}
+  \item{coordinates<-}{\code{signature(object = "AbstractMassObject",
+      value = "numeric|matrix")}
+    Replacement function for coordinates used in imaging mass spectrometry
+    datasets.}
   \item{intensity}{\code{signature(object = "AbstractMassObject")}:
     Accessor function for slot \code{intensity}.}
   \item{intensity<-}{\code{signature(object = "AbstractMassObject",
diff --git a/man/MALDIquant-defunct.Rd b/man/MALDIquant-defunct.Rd
index 5edd807..9d9a665 100644
--- a/man/MALDIquant-defunct.Rd
+++ b/man/MALDIquant-defunct.Rd
@@ -27,6 +27,8 @@
     instead.}
   \item{isMassObject}{removed.}
   \item{isMassObjectList}{removed.}
+  \item{intensityMatrix}{
+    does not support \code{\linkS4class{MassSpectrum}} objects anymore.}
 }
 }
 \keyword{internal}
diff --git a/man/MALDIquant-deprecated.Rd b/man/MALDIquant-deprecated.Rd
index 9293a25..dfee8fe 100644
--- a/man/MALDIquant-deprecated.Rd
+++ b/man/MALDIquant-deprecated.Rd
@@ -2,6 +2,7 @@
 \alias{MALDIquant-deprecated}
 %------ PLEASE: put \alias{.} here for EACH !
 %------ NOTE: ../R/deprecated.R must be synchronized with this!
+\alias{plotImsSlice}
 \title{Deprecated Functions/Methods in Package \pkg{MALDIquant}}
 \description{
   These functions/methods are provided for compatibility with older versions
@@ -9,9 +10,15 @@
 }
 \details{
 \describe{
-  % since MALDIquant 1.8.4
-  \item{intensityMatrix}{
-    deprecated for \code{\linkS4class{MassSpectrum}} objects.}
+  % since MALDIquant x.y.7
+  %\item{function}{explanation}
+  % since MALDIquant 1.11.12
+  \item{\code{plotImsSlice}}{
+    This function allows to plot a slice of an Imaging Mass Spectrometry dataset
+    represented by a \code{list} of \code{\linkS4class{AbstractMassObject}}
+    objects. \cr
+    Use \code{\link[MALDIquant]{plotMsiSlice}} instead.
+  }
 }
 }
 \seealso{
diff --git a/man/MALDIquant-package.Rd b/man/MALDIquant-package.Rd
index d86521b..bd6ffbb 100644
--- a/man/MALDIquant-package.Rd
+++ b/man/MALDIquant-package.Rd
@@ -12,7 +12,9 @@ subtraction methods such as TopHat or SNIP, peak alignment using warping
 functions, handling of replicated measurements as well as allowing spectra with
 different resolutions.
 
-For a first overview run \code{demo("MALDIquant")}.
+For a first overview see
+\code{vignette("MALDIquant-intro", package="MALDIquant")} and/or run
+\code{demo("MALDIquant")}.
 }
 \details{
 \tabular{ll}{
@@ -47,9 +49,12 @@ Website: \url{http://strimmerlab.org/software/maldiquant/}
 }
 \seealso{
   \itemize{
-    \item Introduction: \code{vignette("MALDIquant", package="MALDIquant")}.
+    \item Introduction:
+      \code{vignette("MALDIquant-intro", package="MALDIquant")}.
     \item Run demo files: \code{demo("MALDIquant")}.
     \item List all available manual pages: \code{library(help="MALDIquant")}.
     \item MALDIquant website: \url{http://strimmerlab.org/software/maldiquant/}.
+    \item more MALDIquant examples and complete analyses:
+    \url{https://github.com/sgibb/MALDIquantExamples/}.
   }
 }
diff --git a/man/MALDIquant-parallel.Rd b/man/MALDIquant-parallel.Rd
new file mode 100644
index 0000000..8cbb3c4
--- /dev/null
+++ b/man/MALDIquant-parallel.Rd
@@ -0,0 +1,57 @@
+\name{MALDIquant-parallel}
+\alias{MALDIquant-parallel}
+\title{Parallel Support in Package \pkg{MALDIquant}}
+\description{
+  \code{\link{MALDIquant}} offers multi-core support using
+  \code{\link[parallel]{mclapply}} and \code{\link[parallel]{mcmapply}}. This
+  approach is limited to unix-based platforms.
+
+  Please note that not all functions benfit from parallelisation. Often the
+  overhead to create/copy objects outrun the time saving of parallel runs. This
+  is true for functions that are very fast to compute (e.g.
+  \code{sqrt}-transformation). That's why the default value for the
+  \code{mc.cores} argument in all functions is \code{1L}.
+  It depends on the size of the dataset which step (often only
+  \code{\link[MALDIquant]{removeBaseline}} and
+  \code{\link[MALDIquant]{detectPeaks}}) benefits from parallelisation.
+}
+\details{
+\describe{
+  The following functions/methods support the \code{mc.cores} argument:
+  \itemize{
+    \item{\code{\link[MALDIquant]{trim,list,numeric-method}}}
+    \item{\code{\link[MALDIquant]{transformIntensity,list-method}}}
+    \item{\code{\link[MALDIquant]{removeBaseline,list-method}}}
+    \item{\code{\link[MALDIquant]{calibrateIntensity,list-method}}}
+    \item{\code{\link[MALDIquant]{detectPeaks,list-method}}}
+    \item{\code{\link[MALDIquant]{alignSpectra}}}
+    \item{\code{\link[MALDIquant]{averageMassSpectra}}}
+    \item{\code{\link[MALDIquant]{mergeMassPeaks}}}
+}
+}
+}
+\seealso{
+  \code{\link[parallel]{mclapply}},
+  \code{\link[parallel]{mcmapply}}
+}
+\examples{
+## load package
+library("MALDIquant")
+
+## load example data
+data("fiedler2009subset", package="MALDIquant")
+
+## run single-core baseline correction
+print(system.time(
+  b1 <- removeBaseline(fiedler2009subset, method="SNIP")
+))
+
+if(.Platform$OS.type == "unix") {
+  ## run multi-core baseline correction
+  print(system.time(
+    b2 <- removeBaseline(fiedler2009subset, method="SNIP", mc.cores=2)
+  ))
+  print(all.equal(b1, b2))
+}
+}
+\keyword{misc}
diff --git a/man/alignSpectra-functions.Rd b/man/alignSpectra-functions.Rd
index fb82982..be0ca6b 100644
--- a/man/alignSpectra-functions.Rd
+++ b/man/alignSpectra-functions.Rd
@@ -9,7 +9,7 @@ This function aligns a list of \code{\linkS4class{MassSpectrum}} objects
 }
 \usage{
 alignSpectra(spectra, halfWindowSize=20, noiseMethod="MAD", SNR=2,
-  reference, tolerance=0.002, warpingMethod="lowess")
+  reference, tolerance=0.002, warpingMethod="lowess", \dots)
 }
 \arguments{
   \item{spectra}{
@@ -40,6 +40,8 @@ alignSpectra(spectra, halfWindowSize=20, noiseMethod="MAD", SNR=2,
     used basic warping function; see
     \code{\link[MALDIquant]{determineWarpingFunctions}}.
   }
+  \item{\dots}{arguments to be passed to
+    \code{\link[MALDIquant]{detectPeaks,MassSpectrum-method}}.}
 }
 \details{
   \code{alignSpectra} is a wrapper function around
diff --git a/man/averageMassSpectra-functions.Rd b/man/averageMassSpectra-functions.Rd
index 767ac96..982c6af 100644
--- a/man/averageMassSpectra-functions.Rd
+++ b/man/averageMassSpectra-functions.Rd
@@ -7,7 +7,7 @@ Averages \code{\linkS4class{MassSpectrum}} objects.
 This function averages \code{\linkS4class{MassSpectrum}} objects.
 }
 \usage{
-averageMassSpectra(l, labels, method=c("mean", "median", "sum"))
+averageMassSpectra(l, labels, method=c("mean", "median", "sum"), \dots)
 }
 \arguments{
   \item{l}{
@@ -18,6 +18,8 @@ averageMassSpectra(l, labels, method=c("mean", "median", "sum"))
     \code{\linkS4class{MassSpectrum}} object) to do groupwise averaging.
   }
   \item{method}{used aggregation function.}
+  \item{\dots}{arguments to be passed to underlying functions (currently only
+    \code{mc.cores} is supported).}
 }
 \details{
 The mass of the averaged \code{\linkS4class{MassSpectrum}} object
diff --git a/man/calibrateIntensity-methods.Rd b/man/calibrateIntensity-methods.Rd
index e2f3f12..36c24c4 100644
--- a/man/calibrateIntensity-methods.Rd
+++ b/man/calibrateIntensity-methods.Rd
@@ -12,6 +12,8 @@ This function calibrates (normalize) intensities of
 \usage{
 \S4method{calibrateIntensity}{MassSpectrum}(object,
   method=c("TIC", "PQN", "median"), \dots)
+\S4method{calibrateIntensity}{list}(object,
+  method=c("TIC", "PQN", "median"), \dots)
 }
 \arguments{
   \item{object}{\code{\linkS4class{MassSpectrum}} object or a \code{list} of
@@ -19,13 +21,17 @@ This function calibrates (normalize) intensities of
   \item{method}{the calibration method to be used. This should be one of
     \code{"TIC"}, \code{"PQN"} or \code{"median"}.
     See \sQuote{Details} section.}
-  \item{\dots}{arguments to be passed to other functions (unneeded until now).}
+  \item{\dots}{arguments to be passed to other functions. Currently only
+    \code{range} is for \code{method="TIC"} is supported. If
+    \code{object} is a \code{list} \code{mc.cores} is also supported.}
 }
 \details{
   A number of different calibration methods are provided:
   \describe{
     \item{\code{"TIC"}:}{The TIC (\emph{T}otal \emph{I}on \emph{C}urrent) of a
-      \code{\linkS4class{MassSpectrum}} object is set to one.}
+      \code{\linkS4class{MassSpectrum}} object is set to one. If \code{range} is
+      given the \emph{TIC} is only calculated for the intensities in the
+      specified mass range.}
     \item{\code{"PQN"}:}{The PQN (\emph{P}robabilistic \emph{Q}uotient
       \emph{N}ormalization) is described in \emph{Dieterle et al 2006}.
       \code{calibrateIntensity} uses the following algorithm:
@@ -72,5 +78,8 @@ b <- removeBaseline(fiedler2009subset)
 
 ## calibrate intensity values
 calibrateIntensity(b, method="TIC")
+
+## calibrate intensity values using TIC for a specific mass range
+calibrateIntensity(b, method="TIC", range=c(3000, 5000))
 }
 \keyword{methods}
diff --git a/man/createMassPeaks-functions.Rd b/man/createMassPeaks-functions.Rd
index 1dd2602..3c32a92 100644
--- a/man/createMassPeaks-functions.Rd
+++ b/man/createMassPeaks-functions.Rd
@@ -9,7 +9,7 @@ shouldn't called by the user. Try
 \code{\link[MALDIquant]{detectPeaks,MassSpectrum-method}} instead.
 }
 \usage{
-createMassPeaks(mass, intensity, snr=as.double(rep(NA, length(intensity))),
+createMassPeaks(mass, intensity, snr=as.double(rep.int(NA, length(intensity))),
                 metaData=list())
 }
 \arguments{
diff --git a/man/detectPeaks-methods.Rd b/man/detectPeaks-methods.Rd
index 9dd736e..5496f41 100644
--- a/man/detectPeaks-methods.Rd
+++ b/man/detectPeaks-methods.Rd
@@ -13,6 +13,7 @@ A peak is a local maximum above a user defined noise threshold.
 \S4method{detectPeaks}{MassSpectrum}(object,
   halfWindowSize=20, method=c("MAD", "SuperSmoother"), SNR=2,
   \dots)
+\S4method{detectPeaks}{list}(object, \dots)
 }
 \arguments{
   \item{object}{\code{\linkS4class{MassSpectrum}} object or a \code{list} of
@@ -28,8 +29,8 @@ A peak is a local maximum above a user defined noise threshold.
     \emph{s}ignal-to-\emph{n}oise-\emph{r}atio. A local maximum has to
     be higher than \code{SNR*noise} to be recognize as peak.}
   \item{\dots}{arguments to be passed to
-    \code{\link[MALDIquant]{estimateNoise,MassSpectrum-method}}.
-  }
+    \code{\link[MALDIquant]{estimateNoise,MassSpectrum-method}}. If
+    \code{object} is a \code{list} \code{mc.cores} is also supported.}
 }
 \value{
 Returns a \code{\linkS4class{MassPeaks}} object.
diff --git a/man/intensityMatrix-functions.Rd b/man/intensityMatrix-functions.Rd
index 6ddf0ff..73cf5b5 100644
--- a/man/intensityMatrix-functions.Rd
+++ b/man/intensityMatrix-functions.Rd
@@ -31,7 +31,7 @@ intensity values for missing peaks if \code{spectra} was given or \code{NA}
 otherwise. \cr
 The \code{\link{matrix}} has \code{length(peaks)} rows
 (one row for each sample) and \code{length(unique(mass))} columns.
-The column names of the returned \code{\link{matrix}} store the mass values.
+There is an additional attribute \code{"mass"} that stores the mass values.
 }
 \author{
 Sebastian Gibb \email{mail at sebastiangibb.de}
diff --git a/man/mergeMassPeaks-functions.Rd b/man/mergeMassPeaks-functions.Rd
index 1ff15c3..dd25fbb 100644
--- a/man/mergeMassPeaks-functions.Rd
+++ b/man/mergeMassPeaks-functions.Rd
@@ -7,7 +7,8 @@ Merges \code{\linkS4class{MassPeaks}} objects.
 This function merges \code{\linkS4class{MassPeaks}} objects.
 }
 \usage{
-mergeMassPeaks(l, labels, method=c("mean", "median", "sum"), ignore.na=TRUE)
+mergeMassPeaks(l, labels, method=c("mean", "median", "sum"), ignore.na=TRUE,
+               \dots)
 }
 \arguments{
   \item{l}{
@@ -21,6 +22,8 @@ mergeMassPeaks(l, labels, method=c("mean", "median", "sum"), ignore.na=TRUE)
   \item{ignore.na}{Should \code{NA} (positions where a peak is missing)
     ignored (\code{ignore.na=TRUE}) or treated as zero
     (\code{ignore.na=FALSE})?}
+  \item{\dots}{arguments to be passed to underlying functions (currently only
+    \code{mc.cores} is supported).}
 }
 \value{
 Returns a single (no \code{labels} given) or a \code{\link{list}}
diff --git a/man/msiSlices-functions.Rd b/man/msiSlices-functions.Rd
new file mode 100644
index 0000000..7f77551
--- /dev/null
+++ b/man/msiSlices-functions.Rd
@@ -0,0 +1,76 @@
+\name{msiSlices}
+\title{Turn a list of AbstractMassObjects into a mass spectrometry imaging
+  slice.}
+\alias{msiSlices}
+\description{
+This function turns a mass spectrometry imaging dataset represented by a
+\code{list} of \code{\linkS4class{AbstractMassObject}} objects into an
+\code{\link[MALDIquant]{intensityMatrix}} for each slice (stored in an
+\code{array}).
+}
+\usage{
+msiSlices(x, center, tolerance, method=c("sum", "mean", "median"), adjust=TRUE)
+
+}
+\arguments{
+  \item{x}{a \code{list} of \code{\linkS4class{MassSpectrum}}/
+    \code{\linkS4class{MassPeaks}} objects.}
+  \item{center}{\code{double}, the \code{center} mas value of each slice.}
+  \item{tolerance}{\code{double}, specifies the thickness of the slices
+    (\code{center + c(-tolerance, tolerance)}).}
+  \item{method}{used aggregation function.}
+  \item{adjust}{\code{logical}, if \code{TRUE} the lowest coordinates of the
+    mass spectrometry imaging dataset are set to \code{c(x=1, y=1)} to avoid
+    \code{NA} values at the borders.}
+}
+\details{
+Each \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} object in
+\code{x} must contain a \code{list} named \code{imaging} with an element
+\code{pos} that stores the \code{x} and \code{y} value of the spectrum, e.g.:
+\preformatted{
+> metaData(spectra[[1]])$imaging$pos
+x y
+1 5
+}
+}
+\value{
+Returns an \code{\link{array}} of three dimensions. The first and second
+dimensions contains the x and y coordinates of the image. The third dimension
+represents the index of the \code{center} of each slice. There are two
+additional attributes, namely \code{"center"} and \code{"tolerance"} which store
+the original \code{center} and \code{tolerance} information.
+}
+\author{
+Sebastian Gibb \email{mail at sebastiangibb.de}
+}
+\seealso{
+\code{\linkS4class{AbstractMassObject}},
+\code{\linkS4class{MassSpectrum}},
+\code{\linkS4class{MassPeaks}},
+\code{\link[MALDIquant]{coordinates,AbstractMassObject-method}},
+\code{\link[MALDIquant]{plotMsiSlice,list-method}}
+
+Please find real examples on:
+
+Website: \url{http://strimmerlab.org/software/maldiquant/}
+
+Vignette: \url{https://github.com/sgibb/MALDIquantExamples/raw/master/inst/doc/nyakas2013.pdf}
+
+Shiny: \url{https://github.com/sgibb/ims-shiny/}
+}
+\examples{
+## load package
+library("MALDIquant")
+
+## load example data
+data("fiedler2009subset", package="MALDIquant")
+
+## please note: this is NOT a MSI data set
+## we just add some coordinates for demonstration
+coordinates(fiedler2009subset) <- cbind(x=rep(1:4, 2), y=rep(1:2, each=4))
+
+slices <- msiSlices(fiedler2009subset, center=c(5864.49, 8936.97),
+                    tolerance=0.25)
+
+slices
+}
diff --git a/man/plotImsSlice-functions.Rd b/man/plotImsSlice-functions.Rd
deleted file mode 100644
index dedfa21..0000000
--- a/man/plotImsSlice-functions.Rd
+++ /dev/null
@@ -1,62 +0,0 @@
-\name{plotImsSlice}
-\title{Plots an Imaging Mass Spectrometry dataset.}
-\alias{plotImsSlice}
-\description{
-This function allows to plot a slice of an Imaging Mass Spectrometry dataset
-represented by a \code{list} of \code{\linkS4class{AbstractMassObject}} objects.
-}
-\usage{
-plotImsSlice(x, range=c(0, Inf),
-             sub=paste0("m/z: ", range[1L], "-", range[2L], ""),
-             removeEmptyRows=TRUE, removeEmptyCols=TRUE,
-             colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
-             interpolate=FALSE, \dots)
-}
-\arguments{
-  \item{x}{\code{list}, list of
-    \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} objects.}
-  \item{range}{\code{double}, length 2, range/thickness of the slice.}
-  \item{sub}{\code{character}, sub title for the plot, see
-    \code{\link[graphics]{title}}.}
-  \item{removeEmptyRows}{\code{logical}, Should empty rows be removed?}
-  \item{removeEmptyCols}{\code{logical}, Should empty columns be removed?}
-  \item{colRamp}{colours as \code{colorRamp} \code{function}, see
-    \code{\link[grDevices]{colorRamp}} for details.}
-  \item{interpolate}{logical, use linear interpolation when drawing the image,
-    see \code{\link[graphics]{rasterImage}} for details.}
-  \item{\dots}{arguments to be passed to \code{\link[graphics]{plot}}.}
-}
-\details{
-Each \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} object in
-\code{x} must contain a \code{list} named \code{imaging} with an element
-\code{pos} that stores the \code{x} and \code{y} value of the spectrum, e.g.:
-\preformatted{
-> metaData(spectra[[1]])$imaging$pos
-x y
-1 5
-}
-}
-\author{
-Sebastian Gibb \email{mail at sebastiangibb.de}
-}
-\seealso{
-\code{\linkS4class{AbstractMassObject}},
-\code{\linkS4class{MassSpectrum}},
-\code{\linkS4class{MassPeaks}},
-\code{\link[MALDIquant]{plot,MassSpectrum,missing-method}}
-
-Website: \url{http://strimmerlab.org/software/maldiquant/}
-
-Example:
-\url{https://github.com/sgibb/MALDIquantExamples/blob/master/vignettes/ims.Rnw}
-
-Shiny example: \url{http://spark.rstudio.com/sgibb/ims/},
-\url{https://github.com/sgibb/ims-shiny/}
-}
-\examples{
-\dontrun{
-plotImsSlice(spectra, range = c(3361.8, 3362.8))
-}
-}
-\keyword{Graphics|hplot}
-
diff --git a/man/plotMsiSlice-methods.Rd b/man/plotMsiSlice-methods.Rd
new file mode 100644
index 0000000..3870998
--- /dev/null
+++ b/man/plotMsiSlice-methods.Rd
@@ -0,0 +1,114 @@
+\name{plotMsiSlice-methods}
+\docType{methods}
+\title{Plots a Mass Spectrometry Imaging dataset.}
+\alias{plotMsiSlice}
+\alias{plotMsiSlice,list-method}
+\alias{plotMsiSlice,array-method}
+\alias{plotMsiSlice,matrix-method}
+\description{
+This function allows to plot a slice of a mass spectrometry imaging dataset
+represented by a \code{list} of \code{\linkS4class{AbstractMassObject}} objects
+or an \code{array} or a \code{matrix}.
+}
+\usage{
+\S4method{plotMsiSlice}{list}(x, center, tolerance,
+  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
+  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
+  \dots)
+\S4method{plotMsiSlice}{array}(x,
+  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
+  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
+  plotInteractive=FALSE, \dots)
+\S4method{plotMsiSlice}{matrix}(x,
+  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
+  interpolate=FALSE, scale=TRUE, legend=scale, \dots)
+}
+\arguments{
+  \item{x}{The mass spectrometry imaging dataset. It could be a \code{list} of
+    \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} objects or
+    an \code{array} (e.g. generated by \code{\link[MALDIquant]{msiSlices}}) or
+    a \code{matrix}.}
+  \item{center}{\code{double}, if \code{x} is a \code{list} of
+    \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} objects
+    this argument represent the \emph{center} mass value of the slices,
+    see \code{\link[MALDIquant]{msiSlices}} for details.}
+  \item{tolerance}{\code{double}, if \code{center} is given \code{tolerance}
+    specifies the thickness of the slices (\code{center + c(-tolerance,
+    tolerance)}), see \code{\link[MALDIquant]{msiSlices}} for details.}
+  \item{colRamp}{colours as \code{colorRamp} \code{function}, see
+    \code{\link[grDevices]{colorRamp}} for details. If \code{combine=TRUE}
+    multiple colour functions must be applied as \code{list} with an length that
+    equals the number of given centers.}
+  \item{interpolate}{\code{logical}, use linear interpolation when drawing the
+    image, see \code{\link[graphics]{rasterImage}} for details.}
+  \item{scale}{\code{logical}, if \code{TRUE} all values are divided by the
+    maximal value of the slice to get values between 0 and 1.}
+  \item{legend}{\code{logical}, if \code{TRUE} a reference color gradient is
+    plotted on the right hand side of the plot. The upper color represents the
+    highest value in the slice and the lower color the lowest value
+    respectively. The \code{legend} is disabled if \code{scale=FALSE}.}
+  \item{alignLabels}{\code{logical}, if \code{combine=TRUE} and
+    \code{alignLabels=TRUE} the center positions below the legend are aligned
+    on the right margin otherwise the aligned to their corresponding gradient.}
+  \item{combine}{\code{logical}, if \code{TRUE} multiple centers are plotted in
+    one image. Therefore it would be necessary to apply a list of \code{colRamp}
+    functions (one function for each center). The intensity values for each
+    center of each pixel are compared against each other and the highest scaled
+    intensity determines the center (and the corresponding \code{colRamp}).}
+  \item{plotInteractive}{
+    \code{logical}, if the slice \code{array} contains multiple centers,
+    \code{combine=FALSE} and an interactive plotting device is used a warning is
+    thrown and only the first center would be plotted. Use
+    \code{plotInteractive=TRUE} to overwrite this behaviour and to plot multiple
+    centers on an interactive device.}
+  \item{\dots}{arguments to be passed to \code{\link[graphics]{plot}}, e.g.
+    \code{main}.}
+}
+\details{
+Each \code{\linkS4class{MassSpectrum}}/\code{\linkS4class{MassPeaks}} object in
+\code{x} must contain a \code{list} named \code{imaging} with an element
+\code{pos} that stores the \code{x} and \code{y} value of the spectrum, e.g.:
+\preformatted{
+> metaData(spectra[[1]])$imaging$pos
+x y
+1 5
+}
+}
+\author{
+Sebastian Gibb \email{mail at sebastiangibb.de}
+}
+\seealso{
+\code{\linkS4class{AbstractMassObject}},
+\code{\linkS4class{MassSpectrum}},
+\code{\linkS4class{MassPeaks}},
+\code{\link[MALDIquant]{coordinates,AbstractMassObject-method}},
+\code{\link[MALDIquant]{msiSlices}},
+\code{\link[MALDIquant]{plot,MassSpectrum,missing-method}}
+
+Please find real examples on:
+
+Website: \url{http://strimmerlab.org/software/maldiquant/}
+
+Vignette: \url{https://github.com/sgibb/MALDIquantExamples/raw/master/inst/doc/nyakas2013.pdf}
+
+Shiny: \url{https://github.com/sgibb/ims-shiny/}
+}
+\examples{
+## load package
+library("MALDIquant")
+
+## load example data
+data("fiedler2009subset", package="MALDIquant")
+
+## please note: this is NOT a MSI data set
+## we just add some coordinates for demonstration
+coordinates(fiedler2009subset) <- cbind(x=rep(1:4, 2), y=rep(1:2, each=4))
+
+plotMsiSlice(fiedler2009subset, center=8936.97, tolerance=0.25)
+
+plotMsiSlice(fiedler2009subset, center=c(5864.49, 8936.97), tolerance=0.25,
+             combine=TRUE,
+             colRamp=list(colorRamp(c("#000000", "#FF00FF")),
+                          colorRamp(c("#000000", "#00FF00"))))
+}
+\keyword{Graphics|hplot}
diff --git a/man/removeBaseline-methods.Rd b/man/removeBaseline-methods.Rd
index eab51b3..9cc2322 100644
--- a/man/removeBaseline-methods.Rd
+++ b/man/removeBaseline-methods.Rd
@@ -14,6 +14,7 @@ The intensity of the mass spectrometry data would be reduced by
 \S4method{removeBaseline}{MassSpectrum}(object,
   method=c("SNIP", "TopHat", "ConvexHull", "median"),
   \dots)
+\S4method{removeBaseline}{list}(object, \dots)
 }
 \arguments{
   \item{object}{\code{\linkS4class{MassSpectrum}} object or a \code{list} of
@@ -24,7 +25,8 @@ The intensity of the mass spectrometry data would be reduced by
     \code{\link[MALDIquant]{estimateBaseline,MassSpectrum-method}} for details.
   }
   \item{\dots}{arguments to be passed to
-    \code{\link[MALDIquant]{estimateBaseline,MassSpectrum-method}}.}
+    \code{\link[MALDIquant]{estimateBaseline,MassSpectrum-method}}. If
+    \code{object} is a \code{list} \code{mc.cores} is also supported.}
 }
 \value{
   Returns a modified \code{\linkS4class{MassSpectrum}} object with reduced
diff --git a/man/transformIntensity-methods.Rd b/man/transformIntensity-methods.Rd
index 1b63299..218fcac 100644
--- a/man/transformIntensity-methods.Rd
+++ b/man/transformIntensity-methods.Rd
@@ -11,11 +11,14 @@ intensities of an \code{\linkS4class{AbstractMassObject}} object.
 \usage{
 \S4method{transformIntensity}{AbstractMassObject}(object,
   method=c("sqrt", "log", "log2", "log10"))
+\S4method{transformIntensity}{list}(object, \dots)
 }
 \arguments{
   \item{object}{\code{\linkS4class{AbstractMassObject}} object or a
     \code{list} of \code{\linkS4class{AbstractMassObject}} objects.}
   \item{method}{used transformation method.}
+  \item{\dots}{arguments to be passed to underlying functions. If
+    \code{object} is a \code{list} \code{mc.cores} is also supported.}
 }
 \author{
 Sebastian Gibb \email{mail at sebastiangibb.de}
diff --git a/man/trim-methods.Rd b/man/trim-methods.Rd
index ec1dbbd..6ee2ce9 100644
--- a/man/trim-methods.Rd
+++ b/man/trim-methods.Rd
@@ -11,8 +11,8 @@ This is useful if some mass ranges should be excluded from further analysis.
 }
 \usage{
 \S4method{trim}{AbstractMassObject,numeric}(object, range)
-\S4method{trim}{list,numeric}(object, range)
-\S4method{trim}{list,missing}(object)
+\S4method{trim}{list,numeric}(object, range, \dots)
+\S4method{trim}{list,missing}(object, range, \dots)
 }
 \arguments{
   \item{object}{\code{\linkS4class{AbstractMassObject}} object or a
@@ -21,6 +21,8 @@ This is useful if some mass ranges should be excluded from further analysis.
     right/maximal mass). If missing it is automatically determined (largest
     overlapping mass range) for a \code{list} of
     \code{\linkS4class{AbstractMassObject}}.}
+  \item{\dots}{arguments to be passed to underlying functions (currently only
+    \code{mc.cores} is supported).}
 }
 \author{
 Sebastian Gibb \email{mail at sebastiangibb.de}
diff --git a/src/init.c b/src/init.c
index ac0c1c1..6c4777c 100644
--- a/src/init.c
+++ b/src/init.c
@@ -42,4 +42,3 @@ R_init_MALDIquant(DllInfo *info)
     /* no .C, .Fortran, or .External routines => NULL */
     R_registerRoutines(info, NULL, callMethods, NULL, NULL);
 }
-
diff --git a/src/localMaxima.c b/src/localMaxima.c
index 942dac3..515514f 100644
--- a/src/localMaxima.c
+++ b/src/localMaxima.c
@@ -71,4 +71,3 @@ SEXP C_localMaxima(SEXP y, SEXP s) {
   UNPROTECT(2);
   return(output);
 }
-
diff --git a/src/lowerConvexHull.c b/src/lowerConvexHull.c
index 1e875ed..2575c24 100644
--- a/src/lowerConvexHull.c
+++ b/src/lowerConvexHull.c
@@ -88,4 +88,3 @@ SEXP C_lowerConvexHull(SEXP x, SEXP y) {
 
   return(output);
 }
-
diff --git a/src/morphologicalFilters.c b/src/morphologicalFilters.c
index 75c04c5..fed5668 100644
--- a/src/morphologicalFilters.c
+++ b/src/morphologicalFilters.c
@@ -192,4 +192,3 @@ SEXP C_erosion(SEXP y, SEXP s) {
   UNPROTECT(5);
   return(output);
 }
-
diff --git a/src/snip.c b/src/snip.c
index 0def81e..a28294e 100644
--- a/src/snip.c
+++ b/src/snip.c
@@ -102,4 +102,3 @@ SEXP C_snip(SEXP y, SEXP iterations, SEXP decreasing) {
 
   return(output);
 }
-
diff --git a/tests/testthat/test_approxfun-methods.R b/tests/testthat/test_approxfun-methods.R
index 1fd13b0..97244f8 100644
--- a/tests/testthat/test_approxfun-methods.R
+++ b/tests/testthat/test_approxfun-methods.R
@@ -11,4 +11,3 @@ test_that("approxfun", {
                c(NA, NA, seq(11, 20, by=0.5), NA, NA))
   expect_equal(approxfun(e)(1:20), rep(NA, 20))
 })
-
diff --git a/tests/testthat/test_as-methods.R b/tests/testthat/test_as-methods.R
new file mode 100644
index 0000000..7c6ae03
--- /dev/null
+++ b/tests/testthat/test_as-methods.R
@@ -0,0 +1,8 @@
+context("as")
+
+test_that("as", {
+  p <- createMassPeaks(mass=1:10, intensity=11:20, snr=rep(1, 10),
+                       metaData=list(file="foo"))
+  s <- createMassSpectrum(mass=1:10, intensity=11:20, metaData=list(file="foo"))
+  expect_equal(as(p, "MassSpectrum"), s)
+})
diff --git a/tests/testthat/test_as.matrix-functions.R b/tests/testthat/test_as.matrix-functions.R
index 6de3070..8fe1ef7 100644
--- a/tests/testthat/test_as.matrix-functions.R
+++ b/tests/testthat/test_as.matrix-functions.R
@@ -5,13 +5,14 @@ p <- list(createMassPeaks(mass=1:4, intensity=11:14),
 s <- list(createMassSpectrum(mass=1:5, intensity=11:15),
           createMassSpectrum(mass=1:5, intensity=21:25))
 
-mp <- matrix(c(11:14, NA, NA, 22:25), byrow=T, ncol=5, nrow=2,
+mp <- matrix(c(11:14, NA, NA, 22:25), byrow=TRUE, ncol=5, nrow=2,
              dimnames=list(NULL, 1:5))
-ms <- matrix(c(11:15, 21:25), byrow=T, ncol=5, nrow=2,
+ms <- matrix(c(11:15, 21:25), byrow=TRUE, ncol=5, nrow=2,
              dimnames=list(NULL, 1:5))
 
-mb <- matrix(c(rep(1L, 4), 0L, 0L, rep(1L, 4)), byrow=T, ncol=5, nrow=2,
+mb <- matrix(c(rep(1L, 4), 0L, 0L, rep(1L, 4)), byrow=TRUE, ncol=5, nrow=2,
              dimnames=list(NULL, 1:5))
+attr(mp, "mass") <- attr(ms, "mass") <- attr(mb, "mass") <- 1:5
 
 test_that(".as.matrix.MassObjectsList throws errors", {
   expect_error(MALDIquant:::.as.matrix.MassObjectList(p[[1]]),
diff --git a/tests/testthat/test_averageMassSpectra-functions.R b/tests/testthat/test_averageMassSpectra-functions.R
index 59b3c94..26dacb6 100644
--- a/tests/testthat/test_averageMassSpectra-functions.R
+++ b/tests/testthat/test_averageMassSpectra-functions.R
@@ -7,7 +7,6 @@ meanS <- createMassSpectrum(mass=1:3, intensity=(2:4)+0.5,
                             metaData=list(a=1, b=2:3))
 sumS <- createMassSpectrum(mass=1:3, intensity=c(5, 7, 9),
                            metaData=list(a=1, b=2:3))
-
 p <- c(createMassPeaks(mass=1:3, intensity=1:3, snr=1:3,
                        metaData=list(a=1, b=2)),
        createMassPeaks(mass=1:3, intensity=4:6, snr=4:6,
@@ -18,6 +17,12 @@ test_that("averageMassSpectra", {
                                          labels=c(1:2, 1:2))),
                list(meanS, meanS))
   expect_equal(unname(averageMassSpectra(list(s[[1]], s[[1]], s[[2]], s[[2]]),
+                                         labels=c(1:2, 1:2), method="median")),
+               list(meanS, meanS))
+  expect_equal(unname(averageMassSpectra(list(s[[1]], s[[1]], s[[2]], s[[2]]),
+                                         labels=c(1, 1, 2, 2), method="median")),
+               s)
+  expect_equal(unname(averageMassSpectra(list(s[[1]], s[[1]], s[[2]], s[[2]]),
                                          labels=c(1:2, 1:2), method="sum")),
                list(sumS, sumS))
 })
@@ -42,4 +47,3 @@ test_that(".averageMassSpectra", {
   expect_equal(MALDIquant:::.averageMassSpectra(s), meanS)
   expect_equal(MALDIquant:::.averageMassSpectra(s, fun=colSums), sumS)
 })
-
diff --git a/tests/testthat/test_calibrateIntensity-methods.R b/tests/testthat/test_calibrateIntensity-methods.R
index 54fb970..478f87a 100644
--- a/tests/testthat/test_calibrateIntensity-methods.R
+++ b/tests/testthat/test_calibrateIntensity-methods.R
@@ -23,6 +23,8 @@ test_that("calibrateIntensity works with TIC", {
   expect_equal(totalIonCurrent(sTIC), 1)
   sTIC <- calibrateIntensity(s, method="TIC")
   expect_equal(unlist(lapply(sTIC, totalIonCurrent)), rep(1, 3))
+  sTIC <- calibrateIntensity(s, method="TIC", range=c(2, 4))
+  expect_equal(unlist(lapply(sTIC, totalIonCurrent)), rep(2, 3))
 })
 
 test_that("calibrateIntensity works with median", {
@@ -42,4 +44,3 @@ test_that("calibrateIntensity works with PQN", {
   expect_equal(unlist(lapply(mPQN, totalIonCurrent)),
                c(1, 1, 0.96875))
 })
-
diff --git a/tests/testthat/test_colMedians-functions.R b/tests/testthat/test_colMedians-functions.R
index 008ec82..a7564d7 100644
--- a/tests/testthat/test_colMedians-functions.R
+++ b/tests/testthat/test_colMedians-functions.R
@@ -21,4 +21,3 @@ test_that(".colMedians", {
   expect_equal(MALDIquant:::.colMedians(m), colMedians(m))
   expect_equal(MALDIquant:::.colMedians(m, TRUE), colMedians(m, TRUE))
 })
-
diff --git a/tests/testthat/test_coordinates-methods.R b/tests/testthat/test_coordinates-methods.R
new file mode 100644
index 0000000..2a52263
--- /dev/null
+++ b/tests/testthat/test_coordinates-methods.R
@@ -0,0 +1,40 @@
+context("coordinates")
+
+s <- list(createMassSpectrum(mass=1:5, intensity=6:10,
+                             metaData=list(imaging=list(pos=c(5, 2)))),
+          createMassSpectrum(mass=1:5, intensity=6:10,
+                             metaData=list(imaging=list(pos=c(6, 2)))))
+
+test_that("coordinates", {
+  expect_identical(coordinates(s[[1]]), c(5, 2))
+  expect_identical(coordinates(s), cbind(x=5:6, y=c(2, 2)))
+  expect_identical(coordinates(s, adjust=TRUE), cbind(x=1:2, y=c(1, 1)))
+})
+
+test_that("coordinates<- throws errors", {
+  expect_error(coordinates(s[[1]]) <- LETTERS[1:10])
+  expect_error(coordinates(s[[1]]) <- 1, "2 or 3 coordinates are needed!")
+  expect_error(coordinates(s[[1]]) <- 4, "2 or 3 coordinates are needed!")
+  expect_error(coordinates(s[[1]]) <- cbind(x=1, y=1, z=1, zz=1),
+               "2 or 3 coordinates are needed!")
+  expect_error(coordinates(s) <- cbind(x=1:4), "2 or 3 coordinates are needed!")
+  l <- list(1:10)
+  expect_error(coordinates(l) <- cbind(x=2:3, y=3:4),
+               "is no list of MALDIquant::AbstractMassObject objects!")
+})
+
+test_that("coordinates<- throws warnings", {
+  expect_warning(coordinates(s[[1]]) <- cbind(x=1:2, y=1:2),
+                 "all rows but the first are ignored")
+})
+
+test_that("coordinates<-", {
+  coordinates(s[[1]]) <- 2:3
+  expect_equal(coordinates(s[[1]]), 2:3)
+  coordinates(s[[1]]) <- cbind(x=2, y=3)
+  expect_equal(coordinates(s[[1]]), c(x=2, y=3))
+  coordinates(s[[1]])[2] <- 5
+  expect_equal(coordinates(s[[1]]), c(x=2, y=5))
+  coordinates(s) <- cbind(x=2:3, y=3:4)
+  expect_equal(coordinates(s), cbind(x=2:3, y=3:4))
+})
diff --git a/tests/testthat/test_deprecated-functons.R b/tests/testthat/test_deprecated-functons.R
index e511f79..732ccf8 100644
--- a/tests/testthat/test_deprecated-functons.R
+++ b/tests/testthat/test_deprecated-functons.R
@@ -1,11 +1,20 @@
 context(".deprecated")
 
 test_that(".deprecated", {
-  expect_error(.deprecated("0.1", "foobar", "foobar"))
+  expect_error(.deprecated("0.1", "foo", "bar"), "foobar")
+
+  version <- packageVersion("MALDIquant")
+  version <- paste(version$major, version$minor - 1L, sep=".")
+  expect_warning(.deprecated(version, "foobar"), "foobar")
   expect_message(.deprecated(packageVersion("MALDIquant"), "foobar", "foobar"))
 })
 
 test_that(".deprecatedFunction", {
+  foobar <- function() {
+    .deprecatedFunction("0.1", new="y")
+  }
+  expect_error(foobar(),
+    "\"foobar\" is deprecated..*Use .*y.* instead. See help(.*y*).")
   expect_error(.deprecatedFunction("0.1", old="foobar",
                                    "\"foobar\" is deprecated."))
   expect_error(.deprecatedFunction("0.1", old="foo", new="bar",
@@ -18,10 +27,17 @@ test_that(".deprecatedArgument", {
   }
   expect_error(foobar(1L, 1L),
     "Argument .*x.* is deprecated..*Use .*y.* instead. See help(.*foobar.*).")
+
   foobar <- function(x, y) {
     .deprecatedArgument("0.1", old="x")
   }
   expect_error(foobar(1L, 1L),
     "Argument \"x\" is deprecated.")
-})
 
+  foobar <- function(x, y) {
+    .deprecatedArgument("0.1", old="x", new="y", help="barfoo")
+  }
+  expect_error(foobar(1L, 1L),
+    "Argument .*x.* is deprecated..*Use .*y.* instead. See help(.*barfoo.*).")
+
+})
diff --git a/tests/testthat/test_detectPeaks-methods.R b/tests/testthat/test_detectPeaks-methods.R
index 4aad439..7881ff1 100644
--- a/tests/testthat/test_detectPeaks-methods.R
+++ b/tests/testthat/test_detectPeaks-methods.R
@@ -1,6 +1,11 @@
 context("detectPeaks")
 
 s <- createMassSpectrum(mass=1:5, intensity=c(1, 2, 1, 2, 1))
+p <- createMassPeaks(c(2, 4), c(2, 2), c(Inf, Inf))
+
+test_that("detectPeaks", {
+  expect_equal(detectPeaks(s, halfWindowSize=1), p)
+})
 
 test_that("detectPeaks shows warnings", {
   expect_warning(detectPeaks(createMassSpectrum(mass=double(),
@@ -12,6 +17,5 @@ test_that("detectPeaks works with list of MassSpectrum objects", {
                "no list of MALDIquant::MassSpectrum objects")
   expect_error(detectPeaks(list(s, createMassPeaks(1, 1)),
                "no list of MALDIquant::MassSpectrum objects"))
-  p <- createMassPeaks(c(2, 4), c(2, 2), c(Inf, Inf))
+  expect_equal(detectPeaks(list(s, s), halfWindowSize=1), list(p, p))
 })
-
diff --git a/tests/testthat/test_determineWarpingFunctions-functions.R b/tests/testthat/test_determineWarpingFunctions-functions.R
index 95461d8..14cc85e 100644
--- a/tests/testthat/test_determineWarpingFunctions-functions.R
+++ b/tests/testthat/test_determineWarpingFunctions-functions.R
@@ -30,4 +30,3 @@ test_that("determineWarpingFunctions works with list of MassPeaks objects", {
   wp <- warpMassPeaks(list(p, p), w)
   expect_equal(list(r, r), wp)
 })
-
diff --git a/tests/testthat/test_doByLabel-functions.R b/tests/testthat/test_doByLabel-functions.R
index 9a7e991..fb3ec6d 100644
--- a/tests/testthat/test_doByLabel-functions.R
+++ b/tests/testthat/test_doByLabel-functions.R
@@ -19,7 +19,7 @@ test_that(".doByLabels runs a function for group labels", {
                                             FUN=function(x){ return(1) }), 1)
   expect_identical(unname(MALDIquant:::.doByLabels(l=list(s, s),
                             labels=as.factor(c("a", "b")),
-                            FUN=function(x){ return(1) })),
+                            FUN=function(x)1)),
                    c(1, 1))
 
   l <- list(s, s, s, s)
@@ -35,7 +35,7 @@ test_that(".doByLabels runs a function for group labels", {
                   #labels=as.factor(paste("s", c(1, 2, 10, 11))),
                   labels=factor(paste("s", c(1, 2, 10, 11)),
                         levels=paste("s", c(1, 2, 10, 11))),
-                  FUN=function(x){return(x)})
+                  FUN=function(x)x)
 
   expect_equal(c(1:2, 10:11), unname(sapply(m, function(x)metaData(x)$file)))
 
@@ -43,7 +43,7 @@ test_that(".doByLabels runs a function for group labels", {
   m <- MALDIquant:::.doByLabels(l=l,
                   ## results in factor(c(2, 2, 1, 1), levels=2:1)
                   labels=rep(2:1, each=2),
-                  FUN=function(x){return(x[[1]])})
+                  FUN=function(x)x[[1]])
 
   expect_equal(c(1, 10), unname(sapply(m, function(x)metaData(x)$file)))
 
@@ -51,12 +51,12 @@ test_that(".doByLabels runs a function for group labels", {
   m <- MALDIquant:::.doByLabels(l=l,
                   ## results in factor(c(2, 2, 1, 1), levels=1:2)
                   labels=factor(rep(2:1, each=2)),
-                  FUN=function(x){return(x[[1]])})
+                  FUN=function(x)x[[1]])
 
   expect_equal(c(10, 1), unname(sapply(m, function(x)metaData(x)$file)))
 
 
   ## see https://github.com/sgibb/MALDIquant/issues/1
   expect_equal(unname(MALDIquant:::.doByLabels(l, 1:4, function(x)x[[1]])), l)
+  expect_equal(unname(MALDIquant:::.doByLabels(l, rep(1, 4), function(x)x)), l)
 })
-
diff --git a/tests/testthat/test_estimateBaseline-methods.R b/tests/testthat/test_estimateBaseline-methods.R
index 71d7769..967b58c 100644
--- a/tests/testthat/test_estimateBaseline-methods.R
+++ b/tests/testthat/test_estimateBaseline-methods.R
@@ -1,9 +1,6 @@
 context("estimateBaseline")
 
-i <- rep(10:1, 2)
-s <- createMassSpectrum(mass=1:20, intensity=i)
-m <- matrix(c(1:20, rep(NA, 20)), ncol=2, byrow=FALSE,
-            dimnames=list(list(), list("x", "y")))
+s <- createMassSpectrum(mass=1:20, intensity=rep(10:1, 2))
 
 test_that("estimateBaseline throws errors", {
   expect_error(estimateBaseline(s, method="foobar"),
@@ -17,76 +14,79 @@ test_that("estimateBaseline shows warnings", {
 })
 
 test_that("estimateBaselineConvexHull", {
-  m[, 2] <- c(10:1, rep(1, 10))
-  expect_identical(MALDIquant:::.estimateBaselineConvexHull(1:20, i), m)
+  b <- c(10:1, rep(1, 10))
+  m <- cbind(mass=mass(s), intensity=b)
+  expect_identical(MALDIquant:::.estimateBaselineConvexHull(mass(s),
+                                                            intensity(s)), b)
   ## user method
-  colnames(m) <- c("mass", "intensity")
   expect_identical(estimateBaseline(s, method="ConvexHull"), m)
 })
 
 test_that("estimateBaselineMedian", {
-  m[, 2] <- c(10:4, rep(c(3, 8), each=3), 7:1)
-  m1 <- m
-  m1[, 2] <- c(10:3, rep(c(2, 9), each=2), 8:1)
-  expect_identical(MALDIquant:::.estimateBaselineMedian(1:20, i, 1), m1)
-  expect_identical(MALDIquant:::.estimateBaselineMedian(1:20, i, 2), m)
+  b <- c(10:4, rep(c(3, 8), each=3), 7:1)
+  b1 <- c(10:3, rep(c(2, 9), each=2), 8:1)
+  m <- cbind(mass=mass(s), intensity=b)
+  expect_identical(MALDIquant:::.estimateBaselineMedian(mass(s), intensity(s),
+                                                        1), b1)
+  expect_identical(MALDIquant:::.estimateBaselineMedian(mass(s), intensity(s),
+                                                        2), b)
   ## user method
-  colnames(m) <- c("mass", "intensity")
   expect_identical(estimateBaseline(s, method="median", halfWindowSize=2), m)
 
   ## halfWindowSize
-  expect_error(MALDIquant:::.estimateBaselineMedian(1:20, i, 0),
+  expect_error(MALDIquant:::.estimateBaselineMedian(mass(s), intensity(s), 0),
                "too small")
-  expect_error(MALDIquant:::.estimateBaselineMedian(1:20, i, 20),
+  expect_error(MALDIquant:::.estimateBaselineMedian(mass(s), intensity(s), 20),
                "too large")
 })
 
 test_that("estimateBaselineSnip", {
-  mlist <- list(decreasing=list(m=m, m100=m), increasing=list(m=m, m100=m))
-  mlist$decreasing$m[, 2] <- c(10:1, c(2.5, 4.0, 5.5), 7:1)
-  mlist$decreasing$m100[, 2] <- c(10:1, rep(c(1.25, 1.5, 1.75, 1.375, 1), times=2))
-  mlist$increasing$m[, 2] <- c(10:1, 5:4, 5.5, 7:1)
-  mlist$increasing$m100[, 2] <- c(10:1, 3.75, 3.375, 3:1, 2.5, 4:1)
+  b <- list(decreasing=list(b=c(10:1, c(2.5, 4.0, 5.5), 7:1),
+                            b100=c(10:1, rep(c(1.25, 1.5, 1.75, 1.375, 1),
+                                             times=2))),
+            increasing=list(b=c(10:1, 5:4, 5.5, 7:1),
+                            b100=c(10:1, 3.75, 3.375, 3:1, 2.5, 4:1)))
 
   ## test default decreasing argument
-  expect_identical(MALDIquant:::.estimateBaselineSnip(1:20, i, 2),
-                   mlist$decreasing$m)
+  expect_identical(MALDIquant:::.estimateBaselineSnip(mass(s), intensity(s), 2),
+                   b$decreasing$b)
 
-  for (j in seq(along=mlist)) {
-    d <- names(mlist)[j] == "decreasing"
+  for (j in seq(along=b)) {
+    d <- names(b)[j] == "decreasing"
 
-    expect_identical(MALDIquant:::.estimateBaselineSnip(1:20, i, 2,
-                                                        decreasing=d),
-                     mlist[[j]]$m)
-    expect_equal(MALDIquant:::.estimateBaselineSnip(1:20, i, decreasing=d),
-                 mlist[[j]]$m100)
+    expect_identical(MALDIquant:::.estimateBaselineSnip(mass(s), intensity(s),
+                                                        2, decreasing=d),
+                     b[[j]]$b)
+    expect_equal(MALDIquant:::.estimateBaselineSnip(mass(s), intensity(s),
+                                                    decreasing=d),
+                 b[[j]]$b100)
 
     ## user method
-    colnames(mlist[[j]]$m100) <- colnames(mlist[[j]]$m) <- c("mass", "intensity")
+    m <- cbind(mass=mass(s), intensity=b[[j]]$b)
+    m100 <- cbind(mass=mass(s), intensity=b[[j]]$b100)
     expect_identical(estimateBaseline(s, method="SNIP", iterations=2,
-                                      decreasing=d), mlist[[j]]$m)
-    expect_identical(estimateBaseline(s, iterations=2,
-                                      decreasing=d), mlist[[j]]$m)
-    expect_equal(estimateBaseline(s, decreasing=d), mlist[[j]]$m100)
+                                      decreasing=d), m)
+    expect_identical(estimateBaseline(s, iterations=2, decreasing=d), m)
+    expect_equal(estimateBaseline(s, decreasing=d), m100)
   }
 })
 
 test_that("estimateBaselineTopHat", {
-  m[, 2] <- c(rep(8, 3), 7:1, rep(6, 5), 5:1)
-  m1 <- m
-  m1[, 2] <- c(rep(9, 2), 8:1, rep(8, 3), 7:1)
-  expect_identical(MALDIquant:::.estimateBaselineTopHat(1:20, i, 1), m1)
-  expect_identical(MALDIquant:::.estimateBaselineTopHat(1:20, i, 2), m)
+  b <- c(rep(8, 3), 7:1, rep(6, 5), 5:1)
+  b1 <- c(rep(9, 2), 8:1, rep(8, 3), 7:1)
+  m <- cbind(mass=mass(s), intensity=b)
+  expect_identical(MALDIquant:::.estimateBaselineTopHat(mass(s), intensity(s),
+                                                        1), b1)
+  expect_identical(MALDIquant:::.estimateBaselineTopHat(mass(s), intensity(s),
+                                                        2), b)
 
   ## user method
-  colnames(m) <- c("mass", "intensity")
   expect_identical(estimateBaseline(s, method="TopHat", halfWindowSize=2), m)
 
   ## halfWindowSize
-  expect_error(MALDIquant:::.estimateBaselineTopHat(1:20, i, 0),
+  expect_error(MALDIquant:::.estimateBaselineTopHat(mass(s), intensity(s), 0),
                "too small")
-  expect_error(MALDIquant:::.estimateBaselineTopHat(1:20, i, 20),
+  expect_error(MALDIquant:::.estimateBaselineTopHat(mass(s), intensity(s), 20),
                "too large")
 
 })
-
diff --git a/tests/testthat/test_estimateNoise-methods.R b/tests/testthat/test_estimateNoise-methods.R
index 0b66ce7..600fb97 100644
--- a/tests/testthat/test_estimateNoise-methods.R
+++ b/tests/testthat/test_estimateNoise-methods.R
@@ -1,9 +1,6 @@
 context("estimateNoise-methods")
 
-i <- rep(10:1, 2)
-s <- createMassSpectrum(mass=1:20, intensity=i)
-m <- matrix(c(1:20, rep(NA, 20)), ncol=2, byrow=FALSE,
-            dimnames=list(list(), list("mass", "intensity")))
+s <- createMassSpectrum(mass=1:20, intensity=rep(10:1, 2))
 
 test_that("estimateNoise throws errors", {
   expect_error(estimateNoise(s, method="foobar"),
@@ -20,16 +17,22 @@ test_that("estimateNoise shows warnings", {
 })
 
 test_that(".estimateNoiseMad", {
-  m[, 2] <- stats::mad(i)
-  expect_identical(unname(MALDIquant:::.estimateNoiseMad(1:20, i)),
-                   unname(m))
+  n <- rep(stats::mad(intensity(s)), length(s))
+  m <- cbind(mass=mass(s), intensity=n)
+  expect_identical(MALDIquant:::.estimateNoiseMad(1:20, intensity(s)), n)
+  expect_identical(MALDIquant:::.estimateNoise(mass(s), intensity(s)), n)
+  expect_identical(MALDIquant:::.estimateNoise(mass(s), intensity(s),
+                                               method="MAD"), n)
   expect_identical(estimateNoise(s), m)
   expect_identical(estimateNoise(s, method="MAD"), m)
 })
 
 test_that(".estimateNoiseSuperSmoother", {
-  m[, 2] <- stats::supsmu(x=1:20, y=i)$y
-  expect_identical(unname(MALDIquant:::.estimateNoiseSuperSmoother(1:20, i)),
-                   unname(m))
+  n <- stats::supsmu(x=1:20, y=intensity(s))$y
+  m <- cbind(mass=mass(s), intensity=n)
+  expect_identical(MALDIquant:::.estimateNoiseSuperSmoother(mass(s),
+                                                            intensity(s)), n)
+  expect_identical(MALDIquant:::.estimateNoise(mass(s), intensity(s),
+                                               method="SuperSmoother"), n)
   expect_identical(estimateNoise(s, method="SuperSmoother"), m)
 })
diff --git a/tests/testthat/test_findEmptyMassObjects-functions.R b/tests/testthat/test_findEmptyMassObjects-functions.R
index 1176cb8..8c8dde0 100644
--- a/tests/testthat/test_findEmptyMassObjects-functions.R
+++ b/tests/testthat/test_findEmptyMassObjects-functions.R
@@ -16,4 +16,3 @@ test_that("findEmptyMassObjects", {
   expect_identical(findEmptyMassObjects(list(s, e)), 2L)
   expect_identical(findEmptyMassObjects(list(e, s)), 1L)
 })
-
diff --git a/tests/testthat/test_intensityMatrix-functions.R b/tests/testthat/test_intensityMatrix-functions.R
index c249784..ae89034 100644
--- a/tests/testthat/test_intensityMatrix-functions.R
+++ b/tests/testthat/test_intensityMatrix-functions.R
@@ -5,10 +5,11 @@ p <- list(createMassPeaks(mass=1:4, intensity=11:14),
 s <- list(createMassSpectrum(mass=1:5, intensity=11:15),
           createMassSpectrum(mass=1:5, intensity=21:25))
 
-m <- matrix(c(11:14, NA, NA, 22:25), byrow=T, ncol=5, nrow=2,
+m <- matrix(c(11:14, NA, NA, 22:25), byrow=TRUE, ncol=5, nrow=2,
             dimnames=list(NULL, 1:5))
-e <- matrix(c(11:15, 21:25), byrow=T, ncol=5, nrow=2,
+e <- matrix(c(11:15, 21:25), byrow=TRUE, ncol=5, nrow=2,
             dimnames=list(NULL, 1:5))
+attr(m, "mass") <- attr(e, "mass") <- 1:5
 
 test_that("intensityMatrix throws errors", {
   expect_error(intensityMatrix(p[[1]]),
diff --git a/tests/testthat/test_irregular-functions.R b/tests/testthat/test_irregular-functions.R
index 5b925b2..6df2a68 100644
--- a/tests/testthat/test_irregular-functions.R
+++ b/tests/testthat/test_irregular-functions.R
@@ -4,4 +4,3 @@ test_that(".irregularScore", {
   expect_equal(MALDIquant:::.irregularScore(1:10), 0)
   expect_equal(MALDIquant:::.irregularScore((1:10)[-8]), 1/7)
 })
-
diff --git a/tests/testthat/test_isEmpty-methods.R b/tests/testthat/test_isEmpty-methods.R
index b58dbc7..5567626 100644
--- a/tests/testthat/test_isEmpty-methods.R
+++ b/tests/testthat/test_isEmpty-methods.R
@@ -2,7 +2,8 @@ context("isEmpty")
 
 s <- c(createMassSpectrum(mass=1:10, intensity=11:20),
        createMassSpectrum(mass=1:2, intensity=rep.int(.Machine$integer.max, 2)))
-e <- c(createMassSpectrum(mass=double(), intensity=double()),
+e <- c(createMassSpectrum(mass=double(), intensity=double(),
+                          metaData=list(file="fid")),
        createMassSpectrum(mass=1:10, intensity=rep(0, 10)),
        createMassSpectrum(mass=1:10, intensity=as.double(rep(NA, 10))))
 
@@ -16,8 +17,10 @@ test_that("isEmpty", {
 })
 
 test_that("isEmptyWarning", {
-  expect_warning(MALDIquant:::.isEmptyWarning(e[[1]]), "empty")
+  expect_warning(MALDIquant:::.isEmptyWarning(e[[1]]),
+                 "MassSpectrum object \\(file: fid\\) is empty")
+  expect_warning(MALDIquant:::.isEmptyWarning(e[[2]]),
+                 "MassSpectrum object is empty")
   expect_true(suppressWarnings(MALDIquant:::.isEmptyWarning(e[[1]])))
   expect_false(MALDIquant:::.isEmptyWarning(s[[1]]))
 })
-
diff --git a/tests/testthat/test_isRegular-methods.R b/tests/testthat/test_isRegular-methods.R
index 017d240..f41391f 100644
--- a/tests/testthat/test_isRegular-methods.R
+++ b/tests/testthat/test_isRegular-methods.R
@@ -9,4 +9,3 @@ test_that("isRegular", {
   expect_false(isRegular(createMassSpectrum((1:10)[-8], 1:9)))
   expect_true(isRegular(createMassSpectrum((1:10)[-8], 1:9), threshold=0.15))
 })
-
diff --git a/tests/testthat/test_length-methods.R b/tests/testthat/test_length-methods.R
index 59335ea..8dacc0f 100644
--- a/tests/testthat/test_length-methods.R
+++ b/tests/testthat/test_length-methods.R
@@ -5,4 +5,3 @@ test_that("length", {
   expect_identical(length(createMassSpectrum(mass=double(),
                                              intensity=double())), 0L)
 })
-
diff --git a/tests/testthat/test_localMaxima-functions.R b/tests/testthat/test_localMaxima-functions.R
index e1484d8..ac7395d 100644
--- a/tests/testthat/test_localMaxima-functions.R
+++ b/tests/testthat/test_localMaxima-functions.R
@@ -8,4 +8,3 @@ test_that(".localMaxima", {
   expect_identical(MALDIquant:::.localMaxima(y, 1),
                    c(T, F, T, F, F, F, T))
 })
-
diff --git a/tests/testthat/test_mapply-functions.R b/tests/testthat/test_mapply-functions.R
index 09116b1..bb1c41a 100644
--- a/tests/testthat/test_mapply-functions.R
+++ b/tests/testthat/test_mapply-functions.R
@@ -8,4 +8,3 @@ test_that(".mapply", {
   expect_identical(MALDIquant:::.mapply(f, a, b),
                    mapply(f, a, b, USE.NAMES=FALSE, SIMPLIFY=FALSE))
 })
-
diff --git a/tests/testthat/test_mass-methods.R b/tests/testthat/test_mass-methods.R
index 100c031..9276fa6 100644
--- a/tests/testthat/test_mass-methods.R
+++ b/tests/testthat/test_mass-methods.R
@@ -18,4 +18,3 @@ test_that("mass<-", {
   mass(s)[5:10] <- 5:10
   expect_equal(mass(s), c(11:14, 5:10))
 })
-
diff --git a/tests/testthat/test_merge-functions.R b/tests/testthat/test_merge-functions.R
index 1f6fb00..009904c 100644
--- a/tests/testthat/test_merge-functions.R
+++ b/tests/testthat/test_merge-functions.R
@@ -66,4 +66,3 @@ test_that(".mergeMetaData", {
             characters=c("a", "b", "c", "b", "c"))
   expect_identical(MALDIquant:::.mergeMetaData(l), r)
 })
-
diff --git a/tests/testthat/test_metaData-methods.R b/tests/testthat/test_metaData-methods.R
index 76197f0..30641c6 100644
--- a/tests/testthat/test_metaData-methods.R
+++ b/tests/testthat/test_metaData-methods.R
@@ -11,4 +11,3 @@ test_that("metaData<-", {
   metaData(s) <- l
   expect_identical(metaData(s), l)
 })
-
diff --git a/tests/testthat/test_morphologicalFilter-functions.R b/tests/testthat/test_morphologicalFilter-functions.R
index 4491f46..de47304 100644
--- a/tests/testthat/test_morphologicalFilter-functions.R
+++ b/tests/testthat/test_morphologicalFilter-functions.R
@@ -20,4 +20,3 @@ test_that(".dilation", {
     expect_equal(.dilation(x[[i]], halfWindowSize=2), d[[i]])
   }
 })
-
diff --git a/tests/testthat/test_msiSlices-functions.R b/tests/testthat/test_msiSlices-functions.R
new file mode 100644
index 0000000..ad0ead5
--- /dev/null
+++ b/tests/testthat/test_msiSlices-functions.R
@@ -0,0 +1,59 @@
+context("msiSlices")
+
+test_that("msiSlices", {
+  p <- list(createMassPeaks(mass=1:5, intensity=1:5),
+            createMassPeaks(mass=1:5, intensity=2:6),
+            createMassPeaks(mass=1:5, intensity=3:7))
+  coordinates(p) <- cbind(x=c(2, 2, 3), y=c(2, 3, 2))
+
+  r <- array(c(3, 5, 4, NA), dim=c(x=2, y=2, z=1))
+  attr(r, "center") <- 3
+  attr(r, "tolerance") <- 0.5
+  attr(r, "method") <- "sum"
+
+  expect_equal(msiSlices(p, center=3, tolerance=0.5), r)
+
+  r <- array(c(NA, NA, NA, NA, 3, 5, NA, 4, NA), dim=c(x=3, y=3, z=1))
+  attr(r, "center") <- 3
+  attr(r, "tolerance") <- 0.5
+  attr(r, "method") <- "sum"
+  expect_equal(msiSlices(p, center=3, tolerance=0.5, adjust=FALSE), r)
+})
+
+test_that(".msiSlices", {
+  m <- matrix(c(1:5, 2:6, 3:7), byrow=TRUE, nrow=3)
+  attr(m, "mass") <- 1:5
+  coord <- cbind(x=c(1, 1, 2), y=c(1, 2, 1))
+
+  r <- array(c(3, 5, 4, NA), dim=c(x=2, y=2, z=1))
+  attr(r, "center") <- 3
+  attr(r, "tolerance") <- 0.5
+  attr(r, "method") <- "sum"
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=3, tolerance=0.5), r)
+
+  r[,,1] <- c(9, 15, 12, NA)
+  attr(r, "tolerance") <- 1
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=3, tolerance=1), r)
+
+  r[,,1] <- c(3, 5, 4, NA)
+  attr(r, "tolerance") <- 1
+  attr(r, "method") <- "mean"
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=3, tolerance=1,
+                                       method="mean"), r)
+
+  r[,,1] <- c(3, 5, 4, NA)
+  attr(r, "tolerance") <- 1
+  attr(r, "method") <- "median"
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=3, tolerance=1,
+                                       method="median"), r)
+
+  r <- array(c(6, 12, 9, NA, 9, 15, 12, NA), dim=c(x=2, y=2, z=2))
+  attr(r, "center") <- 2:3
+  attr(r, "tolerance") <- 1
+  attr(r, "method") <- "sum"
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=2:3, tolerance=1), r)
+
+  r[,,2] <- c(15, 25, 20, NA)
+  attr(r, "tolerance") <- 1:2
+  expect_equal(MALDIquant:::.msiSlices(m, coord, center=2:3, tolerance=1:2), r)
+})
diff --git a/tests/testthat/test_plotMsiSlice-functions.R b/tests/testthat/test_plotMsiSlice-functions.R
new file mode 100644
index 0000000..6bac28d
--- /dev/null
+++ b/tests/testthat/test_plotMsiSlice-functions.R
@@ -0,0 +1,35 @@
+context(".plotMsiSlice")
+
+test_that(".array2matrix", {
+  x1 <- array(1:12, dim=c(x=2, y=3, z=2))
+  x2 <- array(1:12, dim=c(1, 12, 1))
+  r1 <- matrix(1:12, nrow=2, ncol=3)
+  r2 <- matrix(1:12, nrow=1, ncol=12)
+
+  expect_identical(MALDIquant:::.array2matrix(x1), r1)
+  expect_identical(MALDIquant:::.array2matrix(x2), r2)
+})
+
+test_that(".colorMatrix", {
+  x <- matrix(c(NA, 1:8, NA), nrow=2)
+  colRamp1 <- colorRamp(c("black", "green"))
+  colRamp2 <- function(x)cbind(0, 0, 30*x)
+  r1 <- matrix(c(NA, rgb(colRamp1(1:8/8), maxColorValue=255), NA), nrow=2)
+  r2 <- matrix(c(NA, rgb(colRamp2(1:8), maxColorValue=255), NA), nrow=2)
+
+  expect_equal(MALDIquant:::.colorMatrix(x, colRamp1), r1)
+  expect_equal(MALDIquant:::.colorMatrix(x, colRamp2, scale=FALSE), r2)
+})
+
+test_that(".combineColorMatrices", {
+  x <- array(c(1:8, 8:1), dim=c(2, 4, 2))
+  col <- array(rep(1:2, each=8), dim=c(2, 4, 2))
+  r <- matrix(rep(2:1, each=4), nrow=2, ncol=4)
+
+  expect_equal(MALDIquant:::.combineColorMatrices(x, col), r)
+})
+
+test_that(".rgb", {
+  r <- cbind(1:255, 1:255, 1:255)
+  expect_equal(MALDIquant:::.rgb(r), rgb(r, maxColorValue=255))
+})
diff --git a/tests/testthat/test_range-functions.R b/tests/testthat/test_range-functions.R
index 2ed79a0..fb794a0 100644
--- a/tests/testthat/test_range-functions.R
+++ b/tests/testthat/test_range-functions.R
@@ -15,4 +15,3 @@ test_that(".reorderRange", {
   expect_identical(MALDIquant:::.reorderRange(c(5L, 10L)), c(5L, 10L))
   expect_identical(MALDIquant:::.reorderRange(c(10L, 5L)), c(5L, 10L))
 })
-
diff --git a/tests/testthat/test_referencePeaks-functions.R b/tests/testthat/test_referencePeaks-functions.R
index aa6af3b..5394971 100644
--- a/tests/testthat/test_referencePeaks-functions.R
+++ b/tests/testthat/test_referencePeaks-functions.R
@@ -41,4 +41,3 @@ test_that("referencePeaks works with different methods", {
                               tolerance=0.05),
                createMassPeaks(mass=c(1+1/300, 3), intensity=rep(1, 2)))
 })
-
diff --git a/tests/testthat/test_removeBaseline-methods.R b/tests/testthat/test_removeBaseline-methods.R
index f8f194c..b400a31 100644
--- a/tests/testthat/test_removeBaseline-methods.R
+++ b/tests/testthat/test_removeBaseline-methods.R
@@ -1,6 +1,7 @@
 context("removeBaseline")
 
 s <- createMassSpectrum(mass=1:20, intensity=rep(10:1, 2))
+e <- createMassSpectrum(double(), double())
 
 test_that("removeBaseline throws errors", {
   expect_error(removeBaseline(s, method="foobar"),
@@ -8,9 +9,11 @@ test_that("removeBaseline throws errors", {
 })
 
 test_that("removeBaseline shows warnings", {
-  expect_warning(estimateBaseline(
-                   createMassSpectrum(mass=double(), intensity=double()),
-                 "empty"))
+  expect_warning(estimateBaseline(e), "empty")
+})
+
+test_that("removeBaseline returns an empty spectrum if input is empty", {
+  expect_identical(suppressWarnings(removeBaseline(e)), e)
 })
 
 test_that("removeBaseline works with ConvexHull", {
@@ -47,4 +50,3 @@ test_that("removeBaseline works with list of MassSpectrum objects", {
                           intensity=c(rep(0, 10), 7.5, 5, 2.5, rep(0, 7)))
   expect_equal(removeBaseline(list(s, s), iterations=2), list(r, r))
 })
-
diff --git a/tests/testthat/test_removeEmptyMassObjects-functions.R b/tests/testthat/test_removeEmptyMassObjects-functions.R
index 974e5ec..3dd79f9 100644
--- a/tests/testthat/test_removeEmptyMassObjects-functions.R
+++ b/tests/testthat/test_removeEmptyMassObjects-functions.R
@@ -16,4 +16,3 @@ test_that("removeEmptyMassObjects", {
   expect_identical(removeEmptyMassObjects(list(s, e)), list(s))
   expect_identical(removeEmptyMassObjects(list(e, s)), list(s))
 })
-
diff --git a/tests/testthat/test_show-methods.R b/tests/testthat/test_show-methods.R
index 3f7b7bb..df1a005 100644
--- a/tests/testthat/test_show-methods.R
+++ b/tests/testthat/test_show-methods.R
@@ -3,47 +3,80 @@ context("show")
 test_that("show", {
   x <- createMassSpectrum(mass=1:10, intensity=11:20,
                           metaData=list(name="example", file="example.mzML"))
-  r <- c(
-   "S4 class type            : MassSpectrum",
-   "Number of m/z values     : 10          ",
-   "Range of m/z values      : 1 - 10      ",
-   "Range of intensity values: 11 - 20     ",
-   "Memory usage             : 1.648 KiB   ",
-   "Name                     : example     ",
-   "File                     : example.mzML")
+  r <- paste0(format(c("S4 class type",
+                       "Number of m/z values",
+                       "Range of m/z values",
+                       "Range of intensity values",
+                       "Memory usage",
+                       "Name",
+                       "File"), justify="left"), ": ",
+              c(format(c("MassSpectrum",
+                         "10",
+                         "1 - 10",
+                         "11 - 20",
+                         MALDIquant:::.memoryUsageStr(x),
+                         "example"), justify="left"),
+                "example.mzML"))
 
-  expect_identical(capture.output(show(x))[-5], r[-5])
+  expect_identical(capture.output(x), r)
 
   x <- createMassPeaks(mass=1:10, intensity=11:20,
-                       metaData=list(name="example", file="example.mzML"))
+                       metaData=list(name="example"))
+  r <- paste0(format(c("S4 class type",
+                       "Number of m/z values",
+                       "Range of m/z values",
+                       "Range of intensity values",
+                       "Range of snr values",
+                       "Memory usage",
+                       "Name"), justify="left"), ": ",
+              format(c("MassPeaks",
+                       "10",
+                       "1 - 10",
+                       "11 - 20",
+                       "NA - NA",
+                       MALDIquant:::.memoryUsageStr(x),
+                       "example"), justify="left"))
 
-  r <- c(
-   "S4 class type            : MassPeaks",
-   "Number of m/z values     : 10       ",
-   "Range of m/z values      : 1 - 10   ",
-   "Range of intensity values: 11 - 20  ",
-   "Range of snr values      : NA - NA  ",
-   "Memory usage             : 1.844 KiB",
-   "Name                     : example  ",
-   "File                     : example.mzML")
-
-  expect_identical(capture.output(show(x))[-6], r[-6])
+  expect_identical(capture.output(x), r)
 
   x <- createMassPeaks(mass=1:10, intensity=11:20, snr=1:10,
                        metaData=list(name=c("example1", "example2"),
                                      file=c("example1.txt", "example2.txt")))
-  r <- c(
-   "S4 class type            : MassPeaks",
-   "Number of m/z values     : 10       ",
-   "Range of m/z values      : 1 - 10   ",
-   "Range of intensity values: 11 - 20  ",
-   "Range of snr values      : 1 - 10   ",
-   "Memory usage             : 1.977 KiB",
-   "Name1                    : example1 ",
-   "Name2                    : example2 ",
-   "File1                    : example1.txt",
-   "File2                    : example2.txt")
-
-  expect_identical(capture.output(show(x))[-6], r[-6])
-})
+  r <- paste0(format(c("S4 class type",
+                       "Number of m/z values",
+                       "Range of m/z values",
+                       "Range of intensity values",
+                       "Range of snr values",
+                       "Memory usage",
+                       "Name1",
+                       "Name2",
+                       "File1",
+                       "File2"), justify="left"), ": ",
+              c(format(c("MassPeaks",
+                         "10",
+                         "1 - 10",
+                         "11 - 20",
+                         "1 - 10",
+                         MALDIquant:::.memoryUsageStr(x),
+                         "example1",
+                         "example2"), justify="left"),
+                "example1.txt", "example2.txt"))
+
+  expect_identical(capture.output(x), r)
 
+  x <- createMassPeaks(double(), double())
+  r <- paste0(format(c("S4 class type",
+                       "Number of m/z values",
+                       "Range of m/z values",
+                       "Range of intensity values",
+                       "Range of snr values",
+                       "Memory usage"), justify="left"), ": ",
+              format(c("MassPeaks",
+                       "0",
+                       "NA",
+                       "NA",
+                       "NA",
+                       MALDIquant:::.memoryUsageStr(x)), justify="left"))
+
+  expect_identical(capture.output(x), r)
+})
diff --git a/tests/testthat/test_smoothIntensity-methods.R b/tests/testthat/test_smoothIntensity-methods.R
index cac083a..084fc4e 100644
--- a/tests/testthat/test_smoothIntensity-methods.R
+++ b/tests/testthat/test_smoothIntensity-methods.R
@@ -1,6 +1,7 @@
 context("smoothIntensity")
 
-s <- createMassSpectrum(mass=1:10, intensity=(1:10)^2)
+i <- c(1:20, 20:1)^2
+s <- createMassSpectrum(mass=1:40, intensity=i)
 
 test_that("smoothIntensity shows warnings", {
   expect_warning(smoothIntensity(
@@ -9,11 +10,16 @@ test_that("smoothIntensity shows warnings", {
 })
 
 test_that("smoothIntensity", {
+  expect_equal(intensity(smoothIntensity(s, method="SavitzkyGolay",
+                                         halfWindowSize=4)),
+               MALDIquant:::.savitzkyGolay(i, halfWindowSize=4))
+  expect_equal(intensity(smoothIntensity(s, method="SavitzkyGolay")),
+               MALDIquant:::.savitzkyGolay(i, halfWindowSize=10))
   expect_equal(length(smoothIntensity(s, method="MovingAverage",
-                                      halfWindowSize=2)), 10)
+                                      halfWindowSize=2)), 40)
   expect_equal(intensity(smoothIntensity(s, method="MovingAverage",
                                          halfWindowSize=2)),
-               MALDIquant:::.movingAverage((1:10)^2, halfWindowSize=2))
+               MALDIquant:::.movingAverage(i, halfWindowSize=2))
 })
 
 test_that("smoothIntensity works with list of MassSpectrum objects", {
@@ -21,8 +27,7 @@ test_that("smoothIntensity works with list of MassSpectrum objects", {
                "no list of MALDIquant::MassSpectrum objects")
   expect_error(smoothIntensity(list(s, createMassPeaks(1, 1)),
                "no list of MALDIquant::MassSpectrum objects"))
-  r <- createMassSpectrum(mass=1:10, intensity=
-                          MALDIquant:::.movingAverage((1:10)^2))
+  r <- createMassSpectrum(mass=1:40, intensity=
+                          MALDIquant:::.movingAverage(i))
   expect_equal(smoothIntensity(list(s, s), method="MovingAverage"), list(r, r))
 })
-
diff --git a/tests/testthat/test_smoothingFilters-functions.R b/tests/testthat/test_smoothingFilters-functions.R
index 88605d9..1fd9afb 100644
--- a/tests/testthat/test_smoothingFilters-functions.R
+++ b/tests/testthat/test_smoothingFilters-functions.R
@@ -59,4 +59,3 @@ test_that(".savitzkyGolay throws errors", {
                                            polynomialOrder=10),
                "The window size has to be larger than the polynomial order.")
 })
-
diff --git a/tests/testthat/test_snr-methods.R b/tests/testthat/test_snr-methods.R
index b338418..9af5060 100644
--- a/tests/testthat/test_snr-methods.R
+++ b/tests/testthat/test_snr-methods.R
@@ -5,4 +5,3 @@ s <- createMassPeaks(mass=1:10, intensity=11:20, snr=rep(2, 10))
 test_that("snr", {
   expect_identical(snr(s), rep(2, 10))
 })
-
diff --git a/tests/testthat/test_subset-methods.R b/tests/testthat/test_subset-methods.R
index 5d557a4..8d4ff9e 100644
--- a/tests/testthat/test_subset-methods.R
+++ b/tests/testthat/test_subset-methods.R
@@ -26,4 +26,3 @@ test_that("logical index based subsetting works on MassPeaks", {
   expect_equal(p[intensity(p) <= 15],
                createMassPeaks(mass=1:5, intensity=11:15, snr=21:25))
 })
-
diff --git a/tests/testthat/test_totalIonCurrent-methods.R b/tests/testthat/test_totalIonCurrent-methods.R
index 1f6c1c0..4715d64 100644
--- a/tests/testthat/test_totalIonCurrent-methods.R
+++ b/tests/testthat/test_totalIonCurrent-methods.R
@@ -8,4 +8,3 @@ test_that("totalIonCurrent", {
   expect_equal(totalIonCurrent(s), 49.5)
   expect_equal(totalIonCurrent(i), as.double(.Machine$integer.max))
 })
-
diff --git a/tests/testthat/test_transformIntensity-methods.R b/tests/testthat/test_transformIntensity-methods.R
index 17e8e4b..60ab509 100644
--- a/tests/testthat/test_transformIntensity-methods.R
+++ b/tests/testthat/test_transformIntensity-methods.R
@@ -11,6 +11,9 @@ test_that("transformIntensity shows warnings", {
 test_that("transformIntensity", {
   expect_equal(intensity(transformIntensity(s, method="sqrt")), 1:10)
   expect_equal(intensity(transformIntensity(s, method="log")), log((1:10)^2))
+  expect_equal(intensity(transformIntensity(s, method="log2")), log2((1:10)^2))
+  expect_equal(intensity(transformIntensity(s, method="log10")),
+               log10((1:10)^2))
 })
 
 test_that("transformIntensity works with list of MassSpectrum objects", {
@@ -28,7 +31,7 @@ test_that(".transformIntensity throws errors", {
 
 test_that(".transformIntensity shows warnings", {
   expect_warning(.transformIntensity(s, fun=function(x)return(-x)),
-                 "Negative intensities generated")
+                 "Negative intensity values are replaced by zeros.")
 })
 
 test_that(".transformIntensity", {
@@ -51,4 +54,3 @@ test_that(".transformIntensity works with list of AbstractMassObject objects", {
   r <- createMassSpectrum(mass=1:10, intensity=1:10)
   expect_equal(.transformIntensity(list(s, s), fun=sqrt), list(r, r))
 })
-
diff --git a/tests/testthat/test_trim-methods.R b/tests/testthat/test_trim-methods.R
index be7d848..19bcbed 100644
--- a/tests/testthat/test_trim-methods.R
+++ b/tests/testthat/test_trim-methods.R
@@ -23,4 +23,3 @@ test_that("trim works with list of AbstractMassObject objects", {
   expect_equal(trim(list(s, s), c(2, 9)), list(r, r))
   expect_equal(trim(list(s, r)), list(r, r))
 })
-
diff --git a/tests/testthat/test_unlist-functions.R b/tests/testthat/test_unlist-functions.R
index 08dc84b..35a0460 100644
--- a/tests/testthat/test_unlist-functions.R
+++ b/tests/testthat/test_unlist-functions.R
@@ -5,4 +5,3 @@ test_that(".unlist doesn't work recursive", {
                                              b=list(c=7:9))),
                    list(1:3, 4:6, 7:9))
 })
-
diff --git a/tests/testthat/test_valid-functions.R b/tests/testthat/test_valid-functions.R
new file mode 100644
index 0000000..a9a7c73
--- /dev/null
+++ b/tests/testthat/test_valid-functions.R
@@ -0,0 +1,25 @@
+context("valid")
+
+test_that(".validAbstractMassObject", {
+  s <- createMassSpectrum(mass=1:10, intensity=1:10)
+  expect_true(MALDIquant:::.validAbstractMassObject(s))
+  s at intensity <- 1
+  expect_identical(MALDIquant:::.validAbstractMassObject(s),
+                   "Lengths of mass (10) and intensity (1) have to be equal.")
+  s at mass <- -1
+  expect_warning(MALDIquant:::.validAbstractMassObject(s),
+                 "Negative mass values found.")
+  s at mass <- 1
+  s at intensity <- -1
+  expect_warning(MALDIquant:::.validAbstractMassObject(s),
+                 "Negative intensity values found.")
+})
+
+test_that(".validMassPeaks", {
+  p <- createMassPeaks(mass=1:10, intensity=1:10, snr=1:10)
+
+  expect_true(MALDIquant:::.validMassPeaks(p))
+  p at intensity <- 1
+  expect_identical(MALDIquant:::.validMassPeaks(p),
+                   "Lengths of intensity (1) and snr (10) have to be equal.")
+})
diff --git a/tests/testthat/test_warp-functions.R b/tests/testthat/test_warp-functions.R
index c02d7aa..68ba813 100644
--- a/tests/testthat/test_warp-functions.R
+++ b/tests/testthat/test_warp-functions.R
@@ -40,4 +40,3 @@ test_that(".warp", {
                list(createMassSpectrum(mass=2:11, intensity=1:10),
                     createMassSpectrum(mass=seq(3, 21, by=2), intensity=1:10)))
 })
-
diff --git a/tests/testthat/test_warpingFunctions-functions.R b/tests/testthat/test_warpingFunctions-functions.R
index 896b192..6a9fe91 100644
--- a/tests/testthat/test_warpingFunctions-functions.R
+++ b/tests/testthat/test_warpingFunctions-functions.R
@@ -25,4 +25,3 @@ test_that(".warpingFunctionCubic", {
   expect_equal(MALDIquant:::.warpingFunctionCubic(1:10, (1:10)^3)(1:10),
                (1:10)^3)
 })
-
diff --git a/tests/testthat/test_which.closest-functions.R b/tests/testthat/test_which.closest-functions.R
index cb82a32..21c8b29 100644
--- a/tests/testthat/test_which.closest-functions.R
+++ b/tests/testthat/test_which.closest-functions.R
@@ -8,4 +8,3 @@ test_that(".which.closest", {
   expect_equal(MALDIquant:::.which.closest(c(0.5, 1.5, exp(1), pi), 1:10),
                c(1, 2, 3, 3))
 })
-
diff --git a/vignettes/bibliography.bib b/vignettes/bibliography.bib
index cf53be9..ea029ff 100644
--- a/vignettes/bibliography.bib
+++ b/vignettes/bibliography.bib
@@ -59,4 +59,3 @@
   issn = {0168-583X},
   url = {http://www.sciencedirect.com/science/article/B6TJN-46YSYTJ-30/2/e0d015ceb8ea8a7bc0702a857a19750b}
 }
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debichem/packages/r-cran-maldiquant.git



More information about the Debichem-commits mailing list