[R-sig-Geo] Problem with Kriging with in strata
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Wed Jan 26 18:35:24 CET 2011
It seems your lt.a contains missing values. Try
x1 <- krige(sas ~ 1, tala[tala$lt.a == 0 & !is.na(tala$lt.a), ], etc.
On 01/26/2011 06:07 PM, Zia Ahmed wrote:
> Hi,
> I am trying to do kriging with in strata. I use the example in book
> "Applied Spatial Data Analysis with R" page:217. It works fine with
> "meuse" data. But when I am trying to use my data it shows some error
> massage.
> Do I missing something here?
> Thanks in advance
> Zia
>
> Note: I am using following codes:
>
>
> coordinates(tala) <- ~ x + y
> gridded(tala.grid) = ~x+y
>> names(tala.grid)
> [1] "lt.a" "lt.b" "elev" "FDID" "wfe_was"
> "was" "was.lt" "elev.sqrt"
> # lt.a= flooding land type 1 and lt.b=flooding land type 2
>
> tala$lt.a <- tala.grid$lt.a[overlay(tala.grid, tala)]
>> names(tala)
>
> [1] "YID" "FDID" "elev" "was" "sas" "lt.a" "lt.b"
>
>
> x1 <- krige(sas ~ 1, tala[tala$lt.a == 0, ],tala.grid[tala.grid$lt.a ==
> 0, ], model = vgm(35,"Sph", 2000, 15), nmin = 8, nmax = 40, maxdist = 1000)
>
> Error in tala[tala$lt.a == 0, ] : NAs not permitted in row index Error
> in krige(sas ~ 1, tala[tala$lt.a == 0, ], tala.grid[tala.grid$lt.a == :
> error in evaluating the argument 'locations' in selecting a method for
> function 'krige'
>
> x2<- krige(sas~1, tala[tala$lt.a == 1, ],tala.grid[tala.grid$lt.a == 1,
> ], model = vgm(30,"Sph", 2000), nmin = 8, nmax = 40, maxdist = 1000)
>
> Error in tala[tala$lt.a == 1, ] : NAs not permitted in row index Error
> in krige(sas ~ 1, tala[tala$lt.a == 1, ], tala.grid[tala.grid$lt.a == :
> error in evaluating the argument 'locations' in selecting a method for
> function 'krige'
>
>
> On 1/22/2011 4:51 PM, Edzer Pebesma wrote:
>>
>> On 01/22/2011 11:18 AM, Patrick Giraudoux wrote:
>>> Hi,
>>>
>>> Does anybody knows if it is possible to fix user defined maximum and
>>> minimum values in the key of a xyplot (or spplot) graphics ? I have a
>>> set of seperate drawings and I would like to keep the same color scheme
>>> between fixed values for all of them (which looks like being not
>>> possible, autokey normally adapting the range of colors to the
>>> particular range of values in each plot.
>> If your object is of class SpatialPointsDataFrame, it may suffice to
>> pass the argument "cuts" with the vector of cuts. If it is
>> grid/polygons/lines, use the "at" component of the "colorkey" argument
>> to specify breaks; see ?levelplot in package lattice.
>>
>>> Patrick
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list