[GRASS-user] i.pca vs. r.covar/m.eigensystem/r.mapcalc

Dylan Beaudette dylan.beaudette at gmail.com
Fri Nov 7 12:54:32 EST 2008


On Friday 07 November 2008, Nikos Alexandris wrote:
> On Wed, 2008-11-05 at 07:06 -0800, Dylan Beaudette wrote:
> > > # trying with R
> > > x <- readRAST6(c('b2','b6','b7'))
> > > x.pca <- prcomp(x at data)
> > >
> > > Error in svd(x, nu = 0) : infinite or missing values in 'x'
> > >
> > >
> > > ## again the same error!
> > >
> > > I'll try another time again.
> > >
> > > Kind regards, Nikos
> >
> > Sounds like NAs are getting in the way. This is a limitation of
> > several R functions, that becomes particularly annoying when working
> > with GIS data. Here are some tips on dealing with NA in GIS data:
> >
> > http://casoilresource.lawr.ucdavis.edu/drupal/node/664
> >
> > Cheers,
> >
> > Dylan
>
> Dylan, great info!!!
>
> I've bombed in another wall :-(
>
> > x.nas <- which(is.na(x at data@MOD2007_242_500_sur_refl_b02) &
>
> is.na(x at data@MOD2007_242_500_sur_refl_b06) & is.na(x at data
> $MOD2007_242_500_sur_refl_b07))
> Error in which(is.na(x at data@MOD2007_242_500_sur_refl_b02) &
> is.na(x at data@MOD2007_242_500_sur_refl_b06) &  :
>   trying to get slot "MOD2007_242_500_sur_refl_b02" from an object
> (class "data.frame") that is not an S4 object
>
> I am working on it. Maybe something relevant with this error in [1]
>
> [1] https://stat.ethz.ch/pipermail/r-devel/2007-December/047743.html

You have a syntax error here:
x at data@MOD2007_242_500_sur_refl_b06
          ^^^^

should be:
x at data$MOD2007_242_500_sur_refl_b06

subtle but important. 

$ is used to access columns from a dataframe
@ is used to access slots

Cheers,

Dylan


-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-user mailing list