Try this simpler example. Just cut and paste below into the RStudio window, highlight and press CTRL ENTER
library(EMSC)
data(fishoil, package = "EMSC")
Raman <- fishoil$Raman[, 850:3300]
EMSC.rep <- EMSC(Raman, degree = 6, reference = Raman[30, ],
replicates = fishoil$replicates)
plot(EMSC.rep)
