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@uib.es

                Knowledge is contagious. Infect truth.
--------------------------------------------------------------------














	[[alternative HTML version deleted]]

