knitr::opts_chunk$set(echo = TRUE,message=FALSE)
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")
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.