"R" is without any doubt a great and wonderful community, and it is nice to see how the package developers and maintainers help you in case you have any doubts.
It was the case some time ago when was writing some posts about the ChemoSpec package and Bryan Hanson helps me with some doubts. After the last post, I wrote a mail to Hans Werner (Pracma Package) , and he replied quickly, telling me the reason the "savgol" function use a vector indeed a matrix, and giving to me some ideas, to convert all the spectra matrix to Savitzky Golay.
Of course one of the ways is to use the apply function. When applying the SG filters there is a reduction in the number of data-points at both sides of the wavelengths, depending of the window size.So I tried this way, to see all the spectra together:
# This script is for first derivative
+ ylab="1/R (SG 1st derivative)",lty=1,col=1,main="SG-1D1104")
+ ylab="1/R (SG 2nd derivative)",lty=1,col=1,main="SG-2D1104")