[R-sig-Geo] newbie bbox type question

Roger Bivand Roger.Bivand at nhh.no
Mon May 30 16:27:22 CEST 2011


On Mon, 30 May 2011, Roger Bivand wrote:

> On Mon, 30 May 2011, Barry Rowlingson wrote:
>
>> 
>> > plot(as(m, "Spatial"))
>> 
>> Coercion with 'as' seems to fail for me:
>> 
>> > rb=bbox(r)
>> > rb
>>        min       max
>> x -2.840466 -2.342137
>> y 54.042700 54.339724
>> > as(rb,"Spatial")
>> 
>> Error in as(rb, "Spatial") :
>>  no method or default for coercing "matrix" to "Spatial"
>> 
>> but using Spatial() works:
>> 
>> plot(Spatial(rb))
>
> Would plot(as(rb, "Spatial")) work - the object needs to be just "Spatial" to 
> just set up the plot device? I didn't check what was what carefully enough.


Ahh - plot(as(r, "Spatial")) ...

>
> Roger
>
>> 
>> despite the warning about Spatial being an abstract class...
>> 
>> 
>>> which drops all the unnecessary stuff. I wasn't sure what was needed,
>>> either. It could be an output file with the data reshaped to "wide" from
>>> "long", but this is just another guess.
>> 
>> Texas may be awake now, but I think it might be a holiday in the USA...
>> 
>> Barry
>> 
>
>

-- 
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