battles<-read.csv("Battles.csv") helmbold<-as.data.frame(cbind(battles,WCP=0.01,LCP=0.01)) reverse<-(helmbold$Results=="Repulsed") normal<-(helmbold$Results!="Repulsed") helmbold.normal<-helmbold[normal,] helmbold.reverse<-helmbold[reverse,] helmbold.normal$WCP<-helmbold.normal$AL/helmbold.normal$AS helmbold.normal$WCP[helmbold.normal$WCP<0.01]<-0.01 helmbold.normal$LCP<-helmbold.normal$DL/helmbold.normal$DS helmbold.normal$LCP[helmbold.normal$DL==0]<-0.01 helmbold.normal$LCP[helmbold.normal$LCP<0.01]<-0.01 helmbold.reverse$WCP<-helmbold.reverse$DL/helmbold.reverse$DS helmbold.reverse$WCP[helmbold.reverse$WCP<0.01]<-0.01 helmbold.reverse$LCP<-helmbold.reverse$AL/helmbold.reverse$AS helmbold.reverse$LCP[helmbold.reverse$LCP<0.01]<-0.01 helmbold<-as.data.frame(rbind(helmbold.normal,helmbold.reverse)) helmbold<-as.data.frame(helmbold,logWCP=0,logLCP=0) library(lattice) xyplot(LCP~WCP|Results,data=helmbold,scales=list(log=c(TRUE,TRUE)),aspect=1.0, xlim=c(0.005,1.5),ylim=c(0.005,1.5)) xyplot(LCP~WCP,data=helmbold[helmbold$Results!="Surrendered",],scales=list(log=c(TRUE,TRUE)),aspect=1.0, xlim=c(0.005,1.5),ylim=c(0.005,1.5)) comparison<-data.frame(nr<-1:100,WCP<-0,LCP<-0) winner<-rnorm(100,0,log10(2)) loser<-rnorm(100,0,log10(2)) comparison$WCP<-0.1*exp(log(10)*winner) comparison$LCP<-0.15*exp(log(10)*loser) xyplot(LCP~WCP,data=comparison,scales=list(log=c(TRUE,TRUE)),aspect=1.0, xlim=c(0.005,1.5),ylim=c(0.005,1.5))