[R-sig-Geo] coordinates

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Jun 22 11:23:41 CEST 2009


I think the construction

coordinates(VEGPROimas20090409punts) <-
VEGPROimas20090409punts[c("xc","yc")]

does replicate them, instead of moving them from the data.frame to the
coords slot.

also, the back-transform,

as.data.frame(VEGPROimas20090409punts)

should put them back.
--
Edzer

Agustin Lobo wrote:
> Hi!
>
> When using
>
> > coordinates(VEGPROimas20090409punts) <- c("xc","yc")
>
> where VEGPROimas20090409punts is a dataframe and xc, yc
> column variables in the dataframe,
> xc and yc are deleted from the @data table of the resultinf spdf.
> I mean:
>
> > VEGPROimas20090409punts[1,]
>   site           image     xc      yc        g    h       hg    v    
> N  Z
> 1    1 SDIM0380_L1.TIF 444088 4624897 1166.573 1340 173.4269 39.5
> 307.6 66
>       Qh   Qv1   Qv2
> 1 13.182 1.415 0.667
>
> > coordinates(VEGPROimas20090409punts) <- c("xc","yc")
>
> > VEGPROimas20090409punts at data[1,]
>   site           image        g    h       hg    v     N  Z     Qh  
> Qv1   Qv2
> 1    1 SDIM0380_L1.TIF 1166.573 1340 173.4269 39.5 307.6 66 13.182
> 1.415 0.667
>
> Is there any way
> to keep xc and yc in the @data table of the resulting spdf?
> I know I can put them back, but often forget. An option might be
> useful.
>
> Thanks
>
> Agus
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> 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.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list