knitr::opts_chunk$set(echo = TRUE,message=FALSE)

Initialization

Loading required libraries

For raster and spatialpolygon classes we need the raster and rgdal packages. The projection of the data is in the Dutch RD-coordinate system.

library(raster)
library(rgdal)
.libPaths("/usr/people/dirksen/R-20160725/x86_64-redhat-linux-gnu-library/3.3/")
library(lubridate)
library(caret)
library(ggplot2)
library(plyr)
library(doParallel)
registerDoParallel(8)
pro=CRS("+init=epsg:28992")
list.files("/nobackup/users/dirksen/CBS/")
cbs2014<-readOGR(dsn="/nobackup/users/dirksen/CBS/",layer="CBSvierkant500m201410")

plotting routines from online

cbs2014[which(cbs2014@data$INW2000==-99998),]<-NA
cbs2014@data$id = rownames(cbs2014@data)
cbs2014.points = ggplot2:::fortify.SpatialPolygonsDataFrame(cbs2014,region="INW2000")
cbs2014.df = join(cbs2014.points,cbs2014@data,by="id")
# cbs2014.df[cbs2014.df <= 0,'id']<- NA

ggplot(cbs2014.df) +
  aes(long,lat,group=group) +
  geom_polygon(aes(fill=INW2000)) +
  # geom_path(color="red") +
  labs(title="CBS Inwoners 2000") +
  coord_equal() +
  scale_colour_brewer()


MariekeDirk/GeoInterpolation documentation built on May 14, 2019, 8:20 a.m.