Hi, I am currently analysis Raman spectroscopic data with the hyperSpec package. I consulted the documentation on this package and I found an example work-flow dedicated to Raman spectroscopy (see the address : http://hyperspec.r-forge.r-project.org/chondro.pdf)
I am currently trying to remove outliers thanks to PCA just as they did in the documentation, but I get a message error I can't explain. Here is my code : "#import the data : T=read.table('bladder bis concatenation colonne.txt',header=TRUE) spec=new("hyperSpec",wavelength=T[,1],spc=t(T[,-1]),data=data.frame(sample=colnames(T[,-1])),label=list(.wavelength="Raman shift (cm-1)",spc="Intensity (a.u.)")) #baseline correction of the spectra spec=spec[,,500~1800] bl=spc.fit.poly.below(spec) spec=spec-bl #normalization of the spectra spec=sweep(spec,1,apply(spec,1,mean),'/') #PCA pca=prcomp(~ spc,data=spec$.,center=TRUE) scores=decomposition(spec,pca$x,label.wavelength="PC",label.spc="score/a.u.") loadings=decomposition(spec,t(pca$rotation),scores=FALSE,label.spc="laoding I/a.u.") #plot the scores of the first 20 PC against all other to have an idea where to find the outliers pairs(scores[[,,1:20]],pch=19,cex=0.5) #identify the outliers thanks to "map.identify" out=map.identify(scores[,,5]) Erreur dans `[.data.frame`(x@data, , j, drop = FALSE) : undefined columns selected Does anybody understand where the problem comes from ? And does anybody know another mean to find spectra outliers ? Thank you in advance. Boule -- View this message in context: http://r.789695.n4.nabble.com/Outlier-removal-by-Principal-Component-Analysis-error-message-tp3496023p3496023.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.