The below works for one trap. Surely there is a quick way to scale it to all of the traps?
> temp.ACAP1<-outer(release.days[Trap=="ACAP1"],collection.days.2[Trap=="ACAP1"],'-') > temp.ACAP1<-ifelse(temp.ACAP1>=0,NA,temp.ACAP1) > diff.ACAP1<-apply(temp.ACAP1,2,max,na.rm=TRUE) Thanks Ben -- View this message in context: http://r.789695.n4.nabble.com/Adapting-R-code-for-different-traps-tp3585215p3585531.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.