#1234567890123456789012345678901234567890123456789012345678901234567890123456789 #NDK 7: Beat Jaggi ; #must-spektren aus ueb-03-mu2a-3 #R ## get functions and data source("http://stat.ethz.ch/Teaching/Datasets/NDK/r-fns.R") d.spec <- read.table("http://stat.ethz.ch/Teaching/Datasets/NDK/spec-reac.dat") ## dim(d.spec) # 121 700 t.wl <- seq(1100,2492,length=ncol(d.spec)) # Wellenlaengen names(d.spec) <- t.wl ## ======================================================================= ## GET DATA s.datatitle <- s.title <- c.env$project <- "NIR spectra" c.env$step <- "data" s.sample <- "d.spec" t.d <- f.getdata(a.series="", a.sd=1, a.plot=T,a.plotc=T) s.time <- 1:nrow(t.d) t.d <- f.selwavel(t.d, 680, 1780) ## -------------------------------------------------------- ## PCA ## -------------------------------------------------------- s.nc0 <- 10 # maximal number of dimensions r.pca <- f.specpca(t.d) s.nc <- 3 g.scpairs() ## labels should be readable t.lab <- rep("-",121) t.i <- seq(1,121,10) t.lab[t.i] <- as.character(t.i) g.scpairs(a.labels=t.lab) ## -------------------------------------------- ## Directions based on observed spectra ## -------------------------------------------- t.dir <- c(1,35,45,85,85,94,95,105) # r.sq <- f.rotation() g.scpairs(r.sq) g.scpairs(r.sq, a.nc=4) g.finaldec(r.sq, a.nc=4) ## ---------------------------------------------