(This article was first published on

**Revolutions**, and kindly contributed to R-bloggers)*by Derek McCrae Norton, Senior Sales Engineer*

To celebrate Talk Like a Pirate Day the best (and by far the nerdiest) way I know how, I thought I would share some R code I wrote a few years back. Some of you will really appreciate the code (but you probably won't let anyone know), and hopefully others will at least appreciate the output.

So, Avast Ye Mateys, without further ado, here is the output followed by the code. And yes, the circumference of all the circles really is pi*r*8. Arr!

```
circle <- function(center.x=0,center.y=0,r=1){
t <- seq(0,2*pi,pi/32)
x<-center.x + r * cos(t)
y<-center.y + r * sin(t)
cbind(x,y)
}
png(file="pir8-flag.png", width = 11, height = 8.5, units = "in", res = 100)
par(mar=c(0, 0, 0, 0), bg="black")
plot(0, 0, asp=1,xlim=c(-2.75, 2.75), ylim=c(-2.5, 1.75), type="n", xlab = NA, ylab = NA, ann=FALSE, axes=FALSE)
# Bones
polygon(circle(1.5,1.125,7/32),col="white",border=NA)
polygon(circle(1.125,1.5,7/32),col="white",border=NA)
polygon(circle(-1.5,-1.125,7/32),col="white",border=NA)
polygon(circle(-1.125,-1.5,7/32),col="white",border=NA)
polygon(circle(-1.5,1.125,7/32),col="white",border=NA)
polygon(circle(-1.125,1.5,7/32),col="white",border=NA)
polygon(circle(1.5,-1.125,7/32),col="white",border=NA)
polygon(circle(1.125,-1.5,7/32),col="white",border=NA)
# Head
polygon(circle(),col="white")
# Eyes
polygon(circle(-.4,.2,1/4),col="black",border=NA)
polygon(circle(.4,.2,1/4),col="black",border=NA)
# Nose
polygon(circle(0,-.4,1/4),col="black",border=NA)
#Teeth
polygon(circle(-.125,-1.125,1/8),col="white",border=NA)
polygon(circle(-.375,-1.125,1/8),col="white",border=NA)
polygon(circle(.125,-1.125,1/8),col="white",border=NA)
polygon(circle(.375,-1.125,1/8),col="white",border=NA)
text(0, -2.3, expression(C[circles] == pi*r*8), col="white", cex=5)
dev.off()
```

To

**leave a comment**for the author, please follow the link and comment on their blog:**Revolutions**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...