read.table("M100_spec.txt",header=TRUE) spec = read.table("M100_spec.txt",header=TRUE) spec.fit <- lm(spec[175:746,2] ~ [175:746,1]) spec.fit <- lm(spec[175:746,2] ~ spec[175:746,1]) summary(spec.fit) abline(spec.fit) plot(spec[:,1],spec[:,2]) plot(spec[,1],spec[,2]) abline(spec.fit) plot(spec[,1],spec[,2],type=l) plot(spec[,1],spec[,2],l) plot(spec[,1],spec[,2],'l') abline(spec.fit) x <- array(1:20, dim=c(4,5)) x spec[:5,1] spec[1:5,1] spec[1:5,] spec[2:5,] spec spec = read.table("M100_spec.txt",header=FALSE) spec[1:3,] spec.boolmask = 21 > spec[,2] >17 spec.boolmask = (spec[,2] >17) spec.boolmask = (spec[,2] >17) & (spec[,2] <20) spec.boolmask spec.fit <- lm(spec[spec.boolmask,2] ~ [spec.boolmask,1]) spec.boolmask spec.fit <- lm(spec[spec.boolmask,2] ~ spec[spec.boolmask,1]) abline(spec.fit) summery(spec.fit) summary(spec.fit) coef(spec.fit)[1] spec.zero = spec - coef(spec.fit)[1] spec.zero = spec spec.zero[,2] = spec[,2] - coef(spec.fit)[1] plot(spec[,1],spec.zero[,2],'l') plot(spec[,1],spec.zero[,2],'l') spec.zero = spec - coef(spec.fit)[1] spec.zero spec.notNull = (spec != 0) spec.notNull spec.notNull = (spec[,2] != 0) spec.notNull ls plot(spec[spec.notNull,1],spec.zero[notNull,2],'l') plot(spec[spec.notNull,1],spec.zero[spec.notNull,2],'l') save() save(fiel="flux2zero.R") q()