From 2dd84269ae6ca67cf0ea272dc7beab2f446185e9 Mon Sep 17 00:00:00 2001 From: tday Date: Tue, 16 Feb 2016 23:26:33 -0600 Subject: [PATCH] corrected number of rows in table. --- SCOTUS_SMR_plot.R | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/SCOTUS_SMR_plot.R b/SCOTUS_SMR_plot.R index 33fcec4..3937c18 100644 --- a/SCOTUS_SMR_plot.R +++ b/SCOTUS_SMR_plot.R @@ -7,8 +7,10 @@ ########################################################## ## Read in the SMRs - smr.data <- read.table("smr.txt",header=TRUE,sep=" ") - + smr.data.all <- read.table("smr.txt",header=TRUE,sep=" ") + summary(smr.data.all) +smr.data <- smr.data.all[-23,] +summary(smr.data) ## Set graphical parameters (margins) par(mar = c(6, 4, 1, 1)) @@ -40,15 +42,15 @@ for (i in 1:22) { ###################################################################################### ## Create the SMR plot backbone - plot(seq(1,23,1),smr.data$smr,pch=22,col="black",bg="black",xaxt="n",yaxt="n", + plot(seq(1,23,1),smr.data.all$smr,pch=22,col="black",bg="black",xaxt="n",yaxt="n", ylim=c(0,4),xlab="",ylab="",cex=1.5) - points(23,smr.data$smr[23],pch=22,col="red",bg="red",cex=1.5) + points(23,smr.data.all$smr[23],pch=22,col="red",bg="red",cex=1.5) ## Add axes and tick-mark labels axis(1,at=1:23,labels=FALSE) axis(2,at=seq(0,4,0.5), labels=FALSE) - text(1:22,par("usr")[3]-0.25,srt=45,adj=1,labels=smr.data$period[1:22],xpd=TRUE,cex=0.9) - text(23,par("usr")[3]-0.25,srt=45,adj=1,labels=smr.data$period[23],xpd=TRUE,cex=0.9,col="red") + text(1:22,par("usr")[3]-0.25,srt=45,adj=1,labels=smr.data.all$period[1:22],xpd=TRUE,cex=0.9) + text(23,par("usr")[3]-0.25,srt=45,adj=1,labels=smr.data.all$period[23],xpd=TRUE,cex=0.9,col="red") axis(2,las=1,at=c(0,0.5,1,1.5,2,2.5,3,3.5,4),labels=c("0.0","0.5","1.0","1.5","2.0","2.5","3.0","3.5","4.0")) ## Add Axis labels @@ -60,6 +62,11 @@ for (i in 1:22) { ## Put in all the confidence bands for (i in 1:22) { - segments(i,smr.data$lci[i],i,smr.data$uci[i],col="black") + segments(i,smr.data.all$lci[i],i,smr.data.all$uci[i],col="black") } - segments(23,smr.data$lci[23],23,smr.data$uci[23],col="red") \ No newline at end of file + segments(23,smr.data.all$lci[23],23,smr.data.all$uci[23],col="red") + + + + + \ No newline at end of file