# This R environment comes with all of CRAN preinstalled, as well as many other helpful packages
# The environment is defined by the kaggle/rstats docker image: https://github.com/kaggle/docker-rstats
# For example, here's several helpful packages to load in 
```
library(ggplot2) # Data visualization
library(readr) # CSV file I/O, e.g. the read_csv function
```

```
system("ls ../input")
```

```
wkt = read.csv('../input/train_wkt_v3.csv')
wkt[wkt[,3]=='MULTIPOLYGON EMPTY',3] = NA

mycols <- adjustcolor(palette(rainbow(10)), alpha.f = 0.3)
opal <- palette(mycols)

library(rgeos)
library(raster)
for(img in 1:25) {
  print(as.character(unique(wkt$ImageId)[img]))
  png(paste0(unique(wkt$ImageId)[img],".png"), width=2*480)
  par(mfrow=c(1,2))
  imgs <- stack(paste0("../input/three_band/", unique(wkt$ImageId)[img],".tif"))
  plotRGB(imgs, stretch = "lin")
  
  k = j = 1
  for(i in (wkt[(img-1)*10+1:10,3])) {
    if(!is.na(i)) {
      plot(readWKT(i), add=ifelse(j==1, F, T), col=k, main=as.character(unique(wkt$ImageId)[img])) # R only has 8 colors by default
      j = j + 1
    }
    k = k + 1
  }
  dev.off()
}
```