Dear R help, I tried to add linear fit lines in intxplot by adding "index.cond = function(x,y) coef(lm(y ~ x))[1]" inside the intxplot(). It didn't help. I would appreciate any help. My dataset and codes are pasted below.
Thanks, A.K. datGreen<- read.table(text=" Time, DarkSt, LightSt 0, 0, 1 1, 0.03, 0.82 2, 0.06, 0.91 3, 0.12, 0.64 4, 0.12, 0.73 5, 0.12, 0.64 6, 0.09, 0.64 7, 0.09, 0.64 8, 0.09, 0.64 9, 0.09, 0.64 10, 0.12, 0.64 11, 0.09, 0.64 12, 0.09, 0.73 13, 0.06, 0.73 14, 0.06, 0.64 15, 0.09, 0.73 16, 0.09, 0.73 17, 0.09, 0.73 18, 0.12, 0.64 19, 0.09, 0.64 20, 0.12, 0.64 ",sep=",",header=TRUE) dat1<-data.frame(time=rep(c(1:20),rep(2,20)),trt=rep(c('D','L'),each=1)) datG<-data.frame(matrix(rbind(datGreen$DarkSt,datGreen$LightSt),ncol=1,byrow=TRUE)) colnames(datG)<-"Response" dat2G<-datG[-1,] dat2G<-data.frame(dat2G) dat2G<-dat2G[-1,] dat2G<-data.frame(dat2G) colnames(dat2G)<- "Response" dat3G<-data.frame(dat1,dat2G) dat4G<-transform(dat3G,trt=ordered(trt,levels=c('D','L'))) dat4G$time<-factor(dat4G$time) position(dat4G$time)<-as.numeric(levels(dat4G$time)) position(dat4G$trt)<-c(10,20) #pdf("GreenDarkvsLight.pdf") intxplot(Response~time,data=dat4G,groups=trt,se=TRUE,ylim=c(0,1),main="Response in Green light") #dev.off() I expect to get fit lined as in the xyplot: xyplot(Response ~ time, dat4G, type = c( "g", "p","r"), groups=trt, index.cond = function(x,y) coef(lm(y ~ x))[1], xlab = "Time in min", ylab = "Response", main="Response in Green light") ______________________________________________ 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.