An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110321/522eceae/attachment.pl>
simple operation on data.frame or spatialPointsDataFrame
3 messages · Eric Boeker, Georg Ruß, Edzer Pebesma
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 at 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
2 days later
I find it hard to tell without being able to look over your shoulder. Maybe you should try to pass a better initial model to fit.variogram; have you tried to plot the initial model with the sample variogram?
On 03/21/2011 11:10 AM, 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 at stat.math.ethz.ch/msg04054.html) Basically one possible solution is to divide the UTM coordinates (meters) by 1000 to convert them in km. But I really do not want to go back to excel to convert the coordinates values. I would like to use R for doing this operation on the coordinates. My questions are: 1. Can this division take place directly on the SpatialPontsDataFrame or it should first be done on the dataframe? 2. How do I do this division to the concerned column? Using the fix(dataframe) or edit.row.names will take me ages and is not a solution. Thanks for your Helps The structure of the data I'm using: Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 2433 obs. of 10 variables: .. ..$ CODAGIS: num [1:2433] 1201038 1501545 1471560 1101438 1267741 ... .. ..$ COND : num [1:2433] 10 10 13 14 14 17 17 18 19 19 ... .. ..$ litho2 : Factor w/ 14 levels "Bg","Bp","Bs",..: 10 10 11 3 10 10 10 11 11 11 ... .. ..$ targ : num [1:2433] 194 233 218 252 217 ... .. ..$ tseas : num [1:2433] 1192 2445 2077 2746 1928 ... .. ..$ amt : num [1:2433] 285 276 269 292 282 ... .. ..$ amprc : num [1:2433] 778 965 1083 632 847 ... .. ..$ qscond : Factor w/ 4 levels "[10,300]","(300,450]",..: 1 1 1 1 1 1 1 1 1 1 ... ..@ coords.nrs : int [1:2] 4 5 ..@ coords : num [1:2433, 1:2] 300199 466229 270440 251040 343761 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "XUTM" "YUTM" ..@ bbox : num [1:2, 1:2] 155702 1331253 534504 1719735 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:2] "XUTM" "YUTM" .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots .. .. ..@ projargs: chr "+proj=utm +zone=29 +datum=WGS84"
_______________________________________________ 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