## load library
library("MALDIquant");
## load readBrukerFlexData library for fid file import
## (is also done automatically by importSingleSpectrum)
library("readBrukerFlexData");
## get examples directory
exampleDirectory <- system.file("Examples", package="readBrukerFlexData");
## read example spectrum
s <- importSingleSpectrum(file.path(exampleDirectory,
"2010_05_19_Gibb_C8_A1/0_A1/1/1SLin/fid"));
## plot spectrum
plot(s);
## estimate baseline (try different parameters)
b1 <- estimateBaseline(s, method="SNIP", iterations=75);
b2 <- estimateBaseline(s, method="SNIP", iterations=150);
## draw baselines on the plot
lines(b1, col=2);
lines(b2, col=3);
## draw legend
legend(x="topright", lwd=1, legend=paste("iterations=", c(75, 150), sep=""),
col=c(2, 3));Run the code above in your browser using DataLab