Skip to content
Prev 20347 / 29559 Next

Problem with China GADM map data?

Hello,

I have cleaned some parts of your code. It runs ok in my computer. The
error message you get is related to the conversion of non-ascii
characters. What is the result of sessionInfo() in your computer?

Best,

Oscar.

library(sp)
library(raster)
library(RColorBrewer)

chn1 <- getData('GADM', country="CHN", level=1)

# Creating my (artificial) groupings of Chinese admin units:
nrofunits <- length(chn1$NAME_1)

groups <- c(rep(1:3,(nrofunits%/%3)),rep(1,2))[order(c(rep(1:3,(nrofunits
%/% 3)),rep(1,2)))]

chn1$groups <- as.factor(groups)


mypalette <- brewer.pal(3,"Reds")
spplot(chn1, zcol="groups", col.regions=mypalette,
       colorkey=FALSE,
       par.settings=list(axis.line=list(col='transparent')))
-----------------------------------------------------------------
Oscar Perpi??n Lamigueiro
Dpto. Ingenier?a El?ctrica (ETSIDI-UPM)
Grupo de Sistemas Fotovoltaicos (IES-UPM)
URL: http://oscarperpinan.github.io
Twitter: @oscarperpinan


2014-02-07 Miriam Lo <lazyhydra at gmail.com>: