# corn borer code obs1<-readLines("European_corn_borer_2003.txt") head(obs1) obs2<-scan("European_corn_borer_2003.txt") head(obs2,50) par(mfrow=c(1,2)) hist(obs2, breaks=max(obs2)-min(obs2)+1) plot(density(obs2)) par(mfrow=c(1,1)) MD<-c(31,28,31,30,31,30,31,31,30,31,30,31) sum(MD) FD<-c(1, 1+cumsum(MD)[-length(MD)]) MN<-month.name[1:12] MN months_in_range <- which(FD >=min(obs2) & FD<= max(obs2)) months_in_range plot(density(obs2)) rug (FD[months_in_range],lwd=2,lend="square") FirstOfMonth<-paste("01",MN[months_in_range]) text(FD[months_in_range],rep(0.0005,length(months_in_range)),FirstOfMonth,cex=0.9,col="blue") text(mean(range(obs2)),-0.0038, "Julian days in 2003",xpd=NA,cex=1.2) # you may have to adjust the y value depending on device