[R-sig-Geo] Error in multiple && !outer : invalid 'x' type in 'x && y'

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 19 08:09:04 CET 2009


On Thu, 19 Mar 2009, Jim Burke wrote:

> A partial answer. plot() these separately shows
> they plot at vastly different dimensions in order
> to fill the plot frame.
>
> I will try a merge in R and see what happens.

Please *do* run traceback() after error messages like these - it takes a 
very long time to try to guess where the error might have occurred. If 
traceback() is too hard, please make a minimal data set reproducing the 
problem available on a website, with a script to provoke the error. Here, 
bbox() of the objects would show the differences in extent.

Essentially, what you are saying is that plotting the non-overlapping 
names of census_block_sp on their label points messes up spplot of tx3_sp, 
right? The spplot() command works without the second component in the 
sp.layout= list? Have you tried assigning the colours in a regular plot() 
command manually, then using text() directly? If you can figure out what 
is going on in base graphics, the lattice graphics case will be resolvable 
too (usually).

Please avoid using the term "merge" - it has no meaning in this context. R 
spatial for vector data is not a GIS for doing topology, really. "Seeing 
what happens" with large and complex objects does look like a recipe for 
trouble, please simplify first as much as possible, and very often you 
will resolve the problem yourself (simplification does work like that, it 
helps you bring your needs closer to what the software is offering by 
removing irrelevant detail).

Hope this helps,

Roger

>
> Thanks,
> Jim
>
> Jim Burke wrote:
>> Thanks in advance everyone. I need assistance
>> resolving the above error. Trying to spplot join
>> or merge two "SpatialPolygonsDataFrame"s
>> 
>> Each set of polys will plot adjacent to each other.
>> They do not overlap.
>> 
>> census_block_sp <- readShapePoly("HD_108_blocks_sp.shp", IDvar="BLKIDFP", 
>> proj4string=CRS("+proj=aea +ellps=GRS80 +datum=WGS84"))
>> tx3_sp <- readShapePoly("HD_108_whole_sp.shp", IDvar="PCT", 
>> proj4string=CRS("+proj=aea +ellps=GRS80 +datum=WGS84"))
>> 
>> 
>> spplot(tx3_sp, c("D_TOT"),
>>    colorkey=list(height=1.0, width=0.6),
>>    main = list(label="HD-108 - Barack Obama \n Votes by Precinct 
>> 11/04/08",cex=1),
>>    sub =  list(label="by Jim Burke, j.burke at earthlink.net",cex=.3),
>>    line=0,
>>    sp.layout = list("sp.text",coordinates(tx3_sp),
>>                    as.character(tx3_sp$PCT,cex = .02),
>>                    as.table = TRUE),
>>                list("sp.text", coordinates(census_block_sp),
>>                    as.character(census_block_sp$NAME, cex = .02),
>>                    col='blue')     )
>> 
>> Error in multiple && !outer : invalid 'x' type in 'x && y'
>> 
>> Thanks,
>> Jim Burke
>> 
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
>> 
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list