[R-sig-Geo] simple operation on data.frame or spatialPointsDataFrame

Georg Ruß research at georgruss.de
Mon Mar 21 11:29:33 CET 2011


On 21/03/11 11:10:24, Eric Boeker wrote:
> Hi All,
>
>
> I'm fitting variograms in GSTAT with fit.variogram. The coordinates are in
> UTM  (meters) and I got the Warning message: *singular model in variogram
> fit*.
>
> I found the reason from a previous archive mail of this warning message. (
> http://www.mail-archive.com/r-sig-geo@stat.math.ethz.ch/msg04054.html)
>
> Basically one possible solution is to divide the UTM coordinates (meters) by
> 1000 to convert them in km.
>
> [...]
> 1. Can this division take place directly on the SpatialPontsDataFrame or
> it should first be done on the dataframe?

Hi Eric,

if you just want to change the UTM coordinates from meters to kilometer
(i.e. divide by 1000), that can be done on the spatialPointsDataFrame, in
the @coords part.

If sppdf is your spatial points data frame, then the following should do:

sppdfN <- sppdf
sppdfN at coords <- sppdf at coords/1000

sppdfN is then the new spatialPointsDataFrame with the coords in km.
Don't know if the result is what you intended.

Regards,
Georg.
-- 
Research Assistant
Otto-von-Guericke-Universität Magdeburg
research at georgruss.de
http://research.georgruss.de



More information about the R-sig-Geo mailing list