Errata code
X <- read.csv("errata-dates.txt",
  colClasses=c("character","numeric","factor","factor"))
X$date <- as.Date(X$date,format="%d-%m-%Y")
X <- X[order(X$date),]
n <- 1:nrow(X)
begin <- as.Date("2008-04-01")
today <- as.Date(Sys.time())
attach(X)
## can't figure out xlim for Dates
png("errata.png",width=6,height=6,units="in",res=200)
par(las=1,bty="l")
plot(c(begin,date,today),c(0,n,n[length(n)]),
     type="s",ylab="Cumulative errors found",axes=FALSE,
     xlab="Date")
axis(side=2)
sdate <- seq.Date(begin,today,by="3 months")
library("RColorBrewer")
axis.Date(side=1,mgp=c(3,2,0),at=sdate,labels=paste("\n",
                            gsub("-","\n",format(sdate,"%b-%Y"))))
ntype <- length(levels(type))
colvec <- brewer.pal(ntype,"Dark2")
points(date,n,col=colvec[type],pch=16)
legend("topleft",
       levels(type),
       col=colvec,
       pch=16,bty="n")
text(date,n,page,adj=c(-0.2,1.2),xpd=NA,cex=0.5)
detach(X)
others <- subset(cbind(X,n),who!="Ben Bolker")
cwho <- as.character(others$who)
cwho[1] <- gsub(" ","\n",cwho[1])
with(others,text(date,n,cwho,pos=2,cex=0.5,xpd=NA))
##                 gsub(" ","\n",who),
##cumerrs = with(X,c(0,n))
## d = as.numeric(c(begin,X$date))
##plot(d,cumerrs)
##d0 = d-14050
##curve(1*((x-14050)-50)/(1+((x-14050)-50)/30),add=TRUE)
##z = nls(cumerrs~a*(d0-s)/(1+(d0-s)/h),start=list(a=1,s=50,h=100))
abline(v=as.Date("2009-09-01"),lty=2)
text(as.Date("2009-09-01"),20,"second\nprinting",pos=4)
dev.off()
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License