I am relatively new to coding and R in general. I am trying to do baseline correction for Raman data I have. My data is in two rows, an x and y-axis. I believe that the data needs to be a matrix and thus the reason why it is not working? I have tried to follow various guides to get it working. This is the code. Please try and help me where I am going wrong. The setwd is linked to the correct place but have removed.
library(baseline)
library(inspectr)
library(spectrolab)
setwd("")
exam = read.delim("top.txt", header=F)
mattt = as.matrix(exam)
bc.irls = baseline(mattt["spectra"][1,, drop=FALSE])
#bl3 <- baseline(spectra(mattt), method = 'irls')
plot(bc.irls)
The original method I am following
# Load data
data(milk)
# The baseline() function is an S4 wrapper for all the different
# baseline correction methods. The default correction method
# is IRLS. Data must be organized as row vectors in a matrix
# or data.frame.
bc.irls <- baseline(milk$spectra[1,, drop=FALSE])
## Not run:
# Computationally heavy
plot(bc.irls)
Thank you!