[STATSGRASS] correlation matrix

Roger Bivand Roger.Bivand at nhh.no
Wed Jun 27 10:28:11 EDT 2007


On Wed, 27 Jun 2007, Carlos "Guâno" Grohmann wrote:

> Hello, I'd like to make some correlation matrix for raster maps in R.
> I tried to
>>  map1<-readRAST6("lageado_10k_fisher_K_15x15")
>>  map2<-readRAST6("lageado_10k_fisher_K_25x25")
>>  cor(map1,map2)
> Error: is.atomic(y) is not TRUE
>
> What is my mistake? I can' make cor() with SpatialGridDataFrame?
> Can I make it with several maps at once?

The imported objects are *not* vectors, but SpatialGridDataFrames. Can I 
suggest:

map <- readRAST6(c("lageado_10k_fisher_K_15x15",
   "lageado_10k_fisher_K_25x25"))
summary(map)
cor(as(map, "data.frame"))

Roger

>
> BTW, the maps have the same size, resolution, etc.
> thanks
>
> Carlos
>
>
>

-- 
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 grass-stats mailing list