title: Draw a circle in a bitmap image and crop pixels outside circle in R
body: <p>I'm loading bitmap images into R with dimensions that are roughly 17,000 X 17,000 pixels. I'd like to find a way to draw a circle with a radius (in pixels) of my choosing around the center of the picture and convert all pixels outside of the circle into NA's. 
  For example, if the radius desired was 500 pixels, all pixels within that distance (500) from the centroid would be kept as is. Any pixel farther than that distance (>= 501) from the centroid would be converted to an NA.   </p>
  
  <p>The bitmap images are made up entirely of 1's and 0's so here's a smaller example of what these images look like.</p>
  
  <pre><code>img=matrix(sample(c(1,0),1000000,replace=TRUE),ncol=1000,nrow=1000)
  image(0:1000,0:1000,img)
  </code></pre>