You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to use your baseline package to experiment with some of the baseline algorithms described in "Liland, K. H., Almøy, T., & Mevik, B.-H. (2010). Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra. Applied Spectroscopy, 64(9), 1007–1016."
I want to apply it to gas chromatography data which at present is in the form of data.frames with 'rt' and 'value' columns, representing x and y axis values respectively.
I tried calling baseline using:
> baseline(as.matrix(fid_df$value, byrow=T))
Error in rep(3, p - 4) : invalid 'times' argument
Alternatively I'm wondering if you could you include some documentation in the package on how to handle this type of issue, or include a function in the package to convert data.frames or vectors into the type of matrix that baseline expects?
The text was updated successfully, but these errors were encountered:
The baseline package expects spectra to appear in rows, but your code creates a matrix with the spectrum in a single column. If you change the conversion from data.frame to matrix to the following it should work:
baseline(matrix(y, nrow=1))
The problem was caused by two things, using as.matrix(), which does not take the arguments you need, and using byrow=T instead of nrow=1. byrow controls the direction in which the matrix is filled, either by rows or by columns, but has no effect on the output dimensions.
The extra fuzz in the milk data is not helping here, so I will remove it in the next package update. I will also look into the possibility of allowing single spectra to be handled in vector format instead of explicitly forcing matrix input.
Hi,
I'm trying to use your baseline package to experiment with some of the baseline algorithms described in "Liland, K. H., Almøy, T., & Mevik, B.-H. (2010). Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra. Applied Spectroscopy, 64(9), 1007–1016."
I want to apply it to gas chromatography data which at present is in the form of data.frames with 'rt' and 'value' columns, representing x and y axis values respectively.
I tried calling baseline using:
But this obviously didn't work.
I have posted a question about this on stackoverflow if you are interested in sharing a response there for others to see: "https://stackoverflow.com/questions/74870099/how-to-convert-dataframe-or-vector-to-matrix-to-use-r-baseline-package-for-dat"
Alternatively I'm wondering if you could you include some documentation in the package on how to handle this type of issue, or include a function in the package to convert data.frames or vectors into the type of matrix that baseline expects?
The text was updated successfully, but these errors were encountered: