View source: R/BuildRawDataMatrix.R
BuildRawDataMatrix | R Documentation |
This function can be used to build a data matrix from ill aligned spectra or of spectra of unequal length. the result is a matrix whereby the first column matches (approximately) with a single left ppm value and the last column matches (approximately) with a single right ppm value. Crucial is that the sample rates of the machine are the same this should be always the case otherwise comparing intensities becomes meaningless. Note that, as standard in NMR spectra, the highest ppm value is on the left
BuildRawDataMatrix(spectrum.list, ppm.list = NULL, ppm.edges.matrix = NULL)
spectrum.list |
A list of the spectra (y-values). Since by definition some of these differ in length this has to be in list form with a single spectrum per list item. |
ppm.list |
The list of corresponding ppm values (x-values) with the highest ppm-value at the beginning (left) as is the convention for NMR spectra. (This our ppm.edges.matrix has to be provided). |
ppm.edges.matrix |
The list with the starting and ending ppm values (highest ppm-value on the left/in the beginning). This or ppm.list has to be provided. |
SpectraAndPPM A list with 2 elements, the DataMatrix and the ppmMatrix.
Charlie Beirnaert, charlie.beirnaert@uantwerpen.be
# this is an example for 3 meaningless spectra lengths_of_spectra <- c(100,150,120) measurement_distance <- 0.01 starting_ppm_values <- c(8.7, 9.0, 9.0) spectra <- list() ppm_values <- list() for (k in 1:3) { spectra[[k]] <- runif(lengths_of_spectra[k], min = 0, max = 10) # note the minus sign in the 'by' statement ppm_values[[k]] <- seq(from = starting_ppm_values[k], by = -measurement_distance, length.out = lengths_of_spectra[k]) } new.Data <- BuildRawDataMatrix(spectrum.list = spectra, ppm.list = ppm_values) spectraMatrix <- new.Data$DataMatrix ppmMatrix <- new.Data$ppmMatrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.