If you have a MassPeaks object and have 0-length values for mass and intensity MALDIquant::binpeaks() will silently propagate values to that object.
Workaround is to check MALDIquant::isEmpty() and remove empty spectra before binPeaks function.
s <- createMassPeaks(mass=1:100, intensity=rnorm(100)^2,
metaData=list(name="example peaks"))
s2 <- createMassPeaks(mass= numeric(0), intensity=numeric(0),
metaData=list(name="example peaks"))
binPeaks(c(s, s2))
[[1]]
S4 class type : MassPeaks
Number of m/z values : 100
Range of m/z values : 1 - 100
Range of intensity values: 3.395e-04 - 1.108e+01
Range of snr values : NA - NA
Memory usage : 3.82 KiB
Name : example peaks
[[2]]
S4 class type : MassPeaks
Number of m/z values : 100
Range of m/z values : 1 - 100
Range of intensity values: 3.395e-04 - 1.108e+01
Range of snr values : NA - NA
Memory usage : 3.82 KiB
Name : example peaks
Also, it seems to only be silent if there are an equal number of empty and non-empty objects.
If you have a MassPeaks object and have 0-length values for mass and intensity MALDIquant::binpeaks() will silently propagate values to that object.
Workaround is to check MALDIquant::isEmpty() and remove empty spectra before binPeaks function.
Also, it seems to only be silent if there are an equal number of empty and non-empty objects.