An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100423/c4639185/attachment.pl>
wish: transparent remove.duplicates on non-duplicated sp objects
2 messages · Víctor Homar Santaner, Edzer Pebesma
Yes, thanks. Will do this.
"V?ctor Homar Santaner" <victor.homar at uib.cat> wrote:
Hi and thanks to all R developers and helpers,>
I'm writing a few words of code to perform automatic ordinary krigings for a number of dates. In my dataset some duplicated locations exist (at the resolution of the coordinates I use) for some days. Thus, I run the straight-forward solution of using the "remove.duplicates" and the process works well.>
The problem is when the loop applies "remove.duplicates" for an object with no duplicates. The output of this command is not the original object but an empty one:>
str(Pst)>
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots> ..@ data :'data.frame': 177 obs. of 1 variable:> .. ..$ PCP: num [1:177] 0 0 0 0 0 0 1.2 0.6 0 0 ...> ..@ coords.nrs : num(0) > ..@ coords : num [1:177, 1:2] 518 494 490 489 490 ...> .. ..- attr(*, "dimnames")=List of 2> .. .. ..$ : chr [1:177] "B001" "B007" "B013" "B014" ...> .. .. ..$ : chr [1:2] "X(km)" "Y(km)"> ..@ bbox : num [1:2, 1:2] 345 4280 612 4438> .. ..- attr(*, "dimnames")=List of 2> .. .. ..$ : chr [1:2] "X(km)" "Y(km)"> .. .. ..$ : chr [1:2] "min" "max"> ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots> .. .. ..@ projargs: chr "+proj=utm +zone=31 +units=km">
remove.duplicates(Pst)>
[1] coordinates PCP > <0 rows> (or 0-length row.names)> Warning messages:> 1: In min(x) : no non-missing arguments to min; returning Inf> 2: In max(x) : no non-missing arguments to max; returning -Inf> 3: In min(x) : no non-missing arguments to min; returning Inf> 4: In max(x) : no non-missing arguments to max; returning -Inf>
Wouldn't it be nice if "remove.duplicates" left objects with no duplicates unmodified?>
Thanks,>
V?ctor.> --> --------------------------------------------------------------------> V?ctor Homar Santaner> Grup de Meteorologia Departament de F?sica> Edif. Mateu Orfila Tel: +34 971 17 2505> Universitat de les Illes Balears Fax: +34 971 17 3426> 07122 Palma de Mallorca (SPAIN) Email: Victor.Homar at uib.es>
Knowledge is contagious. Infect truth.> -------------------------------------------------------------------->
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo