[R-sig-Geo] fortify.SpatialPolygonsDataFrame error

christiaan pauw cjpauw at gmail.com
Sun Aug 19 10:12:07 CEST 2012


Hi everybody

I have the same problem. It seems there is no such function as
invert() . I googled quite a bit an could not find such a function?
Does anyone know of an invert() function in R?

regards
Christiaan

On 27 February 2012 12:27, Paul Hiemstra <paul.hiemstra at knmi.nl> wrote:
> On 02/23/2012 04:48 PM, marion le texier wrote:
>> Hi everyone,
>>
>> I would like to know if someone of you has already got troubles when trying to use ggplot2 with a shape file?
>> Here is what I've done:
>>
>> NUTS1<-readShapeSpatial("nuts1_2003", proj4string=CRS(projargs=("+init=epsg:3035")),IDvar="NUTS1")
>> plot(NUTS1)
>>
>> NUTS1 at data$id <- rownames(NUTS1 at data)
>>
>> # as codes are characters and not numeric values, I've changed them into:
>>
>> test<-as.numeric(seq(1:94))
>> NUTS1 at data$id<-test
>>
>> NUTS1.points <- fortify.SpatialPolygonsDataFrame(NUTS1, region="id")
>>
>> # The function doesn't want to be applied and I get this error message:
>>
>> Erreur dans unionSpatialPolygons(cp, invert(polys)) : input lengths differ
>> De plus : Message d'avis :
>> In split(as.numeric(row.names(attr)), addNA(attr[, region], TRUE)) :
>>   NAs introduits lors de la conversion automatique
>>
>> (sorry for the French comments...)
>>
>>
>> # What I would like to do at the end is :
>>
>> NUTS1.map <- ggplot()+geom_polygon(data=NUTS1.points, aes(long, lat, group=group), fill=NA, colour="black") + coord_map()
>>
>>
>> Do you have any idea of what I'm doing wrong?
>>
>> Thanks you very much for your help!!!
>> Marion
>>
>>
>>       [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

Christiaan Pauw
Nova Institute
www.nova.org.za



More information about the R-sig-Geo mailing list