correlation matrix

3 messages Options
Embed this post
Permalink
Carlos Grohmann-2

correlation matrix

Reply Threaded More More options
Print post
Permalink
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?

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

Carlos


--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano  
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows 95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand

Re: correlation matrix

Reply Threaded More More options
Print post
Permalink
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: [hidden email]

_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass
Roger Bivand
Economic Geography Section
Department of Economics
Norwegian School of Economics and Business Administration
Helleveien 30
N-5045 Bergen, Norway
Carlos Grohmann-2

Re: correlation matrix

Reply Threaded More More options
Print post
Permalink
thanks!



On 6/27/07, Roger Bivand <[hidden email]> wrote:
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: [hidden email]



--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano  
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows 95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
_______________________________________________
statsgrass mailing list
[hidden email]
http://grass.itc.it/mailman/listinfo/statsgrass