Hi,
thanks for the help. I renamed it to letters and it works perfectly now. Thanks again for your time, m From: caspar hallmann [mailto:caspar.hallm...@gmail.com] Sent: Monday, July 18, 2011 9:44 AM To: Matevž PavliÄ Cc: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] predict() LDL error ah... I think it has to do with the names. Try renaming your columns so that they dont start with a number but rather a character. names(z)<-paste(letters[1:ncol(z)],names=z,sep="_") print(spplot(z, zcol=grep("0.pred",z)), col.regions=terrain.colors(64), contour=T, pretty=T, cuts=8, key.space="right") hope it helps Caspar On Mon, Jul 18, 2011 at 9:27 AM, Matevž PavliÄ <matevz.pav...@gi-zrmk.si> wrote: Hi Caspar, still get the same error. The str(z) shows this info : > str(z) Formal class 'SpatialPixelsDataFrame' [package "sp"] with 7 slots ..@ data :'data.frame': 8736 obs. of 9 variables: .. ..$ 0.pred : num [1:8736] 0.174 0.174 0.174 0.174 0.176 ... .. ..$ 0.var : num [1:8736] 0.236 0.236 0.236 0.236 0.236 ... .. ..$ 1.pred : num [1:8736] 0.134 0.134 0.134 0.134 0.117 ... .. ..$ 1.var : num [1:8736] 0.136 0.136 0.136 0.136 0.136 ... .. ..$ 2.pred : num [1:8736] 0.233 0.233 0.233 0.233 0.234 ... .. ..$ 2.var : num [1:8736] 0.0613 0.0613 0.0613 0.0613 0.0613 ... .. ..$ cov.0.1: num [1:8736] -0.0509 -0.0509 -0.0509 -0.0509 -0.0509 ... .. ..$ cov.0.2: num [1:8736] -0.0171 -0.0171 -0.0171 -0.0171 -0.0171 ... .. ..$ cov.1.2: num [1:8736] -0.0164 -0.0164 -0.0164 -0.0164 -0.0164 ... > str(z) ... But when i use : > print(spplot(z, zcol=which(names(z)=="0.pred")), > col.regions=terrain.colors(64), contour=T, pretty=T, cuts=8, > key.space="right") i get the same error : Error in parse(text = x) : <text>:1:3: unexpected symbol 1: 0.pred ^ thanks for help,m From: caspar hallmann [mailto:caspar.hallm...@gmail.com] Sent: Monday, July 18, 2011 8:58 AM To: Matev¾ Pavliè Subject: Re: [R-sig-Geo] predict() LDL error Hi Matev¾ try: print(spplot(z, zcol=which(names(z)=="0.pred")), col.regions=terrain.colors(64), contour=T, pretty=T, cuts=8, key.space="right") Greets Caspar 2011/7/18 Matev¾ Pavliè <matevz.pav...@gi-zrmk.si> ...and attachement... r, m -----Original Message----- From: r-sig-geo-boun...@r-project.org [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of Matev¾ Pavliè Sent: Monday, July 18, 2011 8:47 AM To: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] predict() LDL error Hi Edzer, thanks for the help, i managed to use the predict() function now. But when I try to plot the predictions using spplot() i get this error : "Error in parse(text = x) : <text>:1:3: unexpected symbol 1: 0.pred" Where 0.pred is the the prediction to plot. Does anyone has any ideas to what this could mean? I've searcehd the forum, but failed to get any answers. (attached is the code I use). Thanks for your time, m -----Original Message----- From: r-sig-geo-boun...@r-project.org [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of Edzer Pebesma Sent: Friday, July 15, 2011 11:15 AM To: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] predict() LDL error to remove duplicates in DF you need to replace it: DF = remove.duplicates(DF, zero=0, remove.second = TRUE) zerodist(DF) On 07/15/2011 10:23 AM, Matev¾ Pavliè wrote: > Hi, thanks for your time.... > > I am sure the problem is in same locations...but i dont know why > remove.duplicates() does not remove duplicates... > When i try this : > >> coordinates(DF)<-~X+Y >> zerodist(DF) > [,1] [,2] > [1,] 83 84 > [2,] 242 243 > [3,] 266 267 > [4,] 431 432 > [5,] 439 440 > [6,] 731 732 > [7,] 817 818 > [8,] 820 821 > >> remove.duplicates(DF, zero=0, remove.second = TRUE) > ... > 1113 (99447.1, 459012) 7019 290.17 286.57 6 > 1114 (99465.2, 458975) 7022 291.97 287.27 0 > 1115 (99410, 458997) 7015 291.04 288.74 6 > 1116 (99495, 458978) 7016 290.62 288.72 6 > 1117 (99438.3, 458992) 7018 291.28 288.38 6 > 1118 (99813, 458891) 7021 290.08 285.58 0 > >> zerodist(DF) > [,1] [,2] > [1,] 83 84 > [2,] 242 243 > [3,] 266 267 > [4,] 431 432 > [5,] 439 440 > [6,] 731 732 > [7,] 817 818 > [8,] 820 821 > > it stays the same...shouln't it remove the duplicates? > > > thanks, m > > -----Original Message----- > From: r-sig-geo-boun...@r-project.org > [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of Edzer Pebesma > Sent: Thursday, July 14, 2011 11:25 PM > To: r-sig-geo@r-project.org > Subject: Re: [R-sig-Geo] predict() LDL error > > The error message is an indication that you're predicting (kriging) with a > singular covariance matrix. The most frequent reasons for this are duplicate > observations [1] or perfect correlation in the coregionalization model [2]. > For [1], see ?remove.duplicates, for [2] see argument correct.diagonal in > ?fit.lmc. > > On 07/14/2011 06:18 PM, Matev¾ Pavliè wrote: >> Hi all, >> >> >> >> i am trying to use categorical kriging for prediction of soil classes in an >> area. I am pretty new to using cat. kriging in R soI probably am making some >> beginers mistakes. Attached is a reproducable sample with sample data. >> >> >> >> When i try to use predict() i geta n error- I am pretty sure because some >> points are duplicated....in krige() function i use zerodist() which >> eliminates the LDL error, but i can't find a way to use it here.... >> >> >> >> I got this code (mostly) from the net, so i have some trouble understanding >> it... >> >> >> >> thanks for any help and info about categorical kriging, >> >> >> >> m >> >> >> >> >> >> >> >> _______________________________________________ >> R-sig-Geo mailing list >> R-sig-Geo@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 > <tel:%2B49%20251%208333081> <tel:%2B49%20251%208333081> , Fax: +49 251 > 8339763 <tel:%2B49%20251%208339763> <tel:%2B49%20251%208339763> > http://ifgi.uni-muenster.de <http://ifgi.uni-muenster.de/> > <http://ifgi.uni-muenster.de/> > http://www.52north.org/geostatistics e.pebe...@wwu.de > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@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 <tel:%2B49%20251%208333081> <tel:%2B49%20251%208333081> , Fax: +49 251 8339763 <tel:%2B49%20251%208339763> <tel:%2B49%20251%208339763> http://ifgi.uni-muenster.de <http://ifgi.uni-muenster.de/> <http://ifgi.uni-muenster.de/> http://www.52north.org/geostatistics e.pebe...@wwu.de _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo