# Forget talk like a pirate… Code like a pirate!

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**Revolutions**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

*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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.