we will need the following packages:
library(sp) # provides classes
library(maptools) # provides i/o, coercion
library(raster)
library(rgeos)
library(rgdal)
to read the polygon shapefile we use readshapepoly function:
bil=readShapePoly('bilan')
rbd=readShapePoly('B01_oblasti_povodi')
plot(rbd)
x = rnorm(1000000)