I am attempting to draw a checkerboard in R by creating a function that will take two parameters (the colors of the checkerboard); using only base R:
checkerboard <- function(color1, color2) {
for (x in 1:8){
for (y in 1:8){
plot(0,0, xlim=c(0,8), ylim=c(0,8), axes=F, ylab = "", xlab = "")
polygon(c(0, 0, 1, 1), c(0, 1, 1, 0), col = 'red')
}
}
So far, the for loop in the function gives me one square, and I am trying to figure out how to draw the others.

