[prev in list] [next in list] [prev in thread] [next in thread]
List: grass-stats
Subject: Re: [GRASS-stats] Error slot - spgrass6
From: Roger Bivand <Roger.Bivand () nhh ! no>
Date: 2011-08-22 7:38:39
Message-ID: alpine.LRH.2.00.1108220936490.10038 () reclus ! nhh ! no
[Download RAW message or body]
On Mon, 22 Aug 2011, Gaspar Reyes Póndigo wrote:
> Hi, Dear Grass-stats users
>
> I am new user R 2.13 (spgrass6) from GRASS-GIS 6.4.1-5, under Mac OS X
> 10.68. I have the following problem, when preparing the data before run
> R's princomp() function in R from GRASS, there was an error. The line of
> code is copied below:
>
Please only post to one list at a time, and wait patiently for an answer.
>
> #########################################
> library(spgrass6)
>
> G <- gmeta6()
>
> ATC <- readRAST6(c('Acrf_1993_b1','Acrf_1993_b2','Acrf_1993_b3','Acrf_1993_b4','Acrf_1993_b5','Acrf_1993_b7'))
>
> ATC.nas <- which(is.na(ATC@data$Acrf_1993_b1) & is.na(ATC@data$Acrf_1993_b2) & \
> is.na(ATC@data$Acrf_1993_b3) & is.na(ATC@data$Acrf_1993_b4) & \
> is.na(ATC@data$Acrf_1993_b5) & is.na(ATC@data$Acrf_1993_b7))
Never access columns with ...@data$... which is exactly the same as
...$...
>
> ATC.ms.values <- which(!is.na(ATC@data$Acrf_1993_b1) & \
> !is.na(ATC@data$Acrf_1993_b2) & !is.na(ATC@data$Acrf_1993_b3) & \
> !is.na(ATC@data$Acrf_1993_b4) & !is.na(ATC@data$Acrf_1993_b5) & \
> !is.na(ATC@data$Acrf_1993_b7))
> #######################################
> #### I got the following error message
> #######################################
> ATC.ms.nonas <- ATC.ms.values@data[ATC.ms.values, ]
str(ATC.ms.values) is certainly integer. I believe that you want to say
either (may need casting to SpatialPixelsDataFrame first):
ATC.ms.nonas <- ATC[ATC.ms.values,]
or
ATC.ms.nonas <- as(ATC, "data.frame")[ATC.ms.values,]
> Error: tentativa de obtener un slot "data" de un objeto de una clase
> básica ("integer") sin slots
which is very clear. Do use str() or class() to check the objects you are
using.
Roger
>
#########################################
>
> Can you please point my problem? and How do I fix my problem?
> Thanks in advance for any help.
>
> NOTE:I followed the guide of \
> http://grass.osgeo.org/wiki/Principal_Components_Analysis # \
> Using_R.27s_princomp.28.29_function for PRINCOMP() function.
> NOTE: the images are LANDSAT 5 TM
>
>
> Gaspar Reyes Póndigo
> Universidad del Mar, Oaxaca, México
> Campus Puerto-Ángel
> Carretera principal Puerto Ángel Zipolite km 1.5
> C.P. 70902_______________________________________________
> grass-stats mailing list
> grass-stats@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no
_______________________________________________
grass-stats mailing list
grass-stats@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-stats
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic