[R-sig-Geo] problem with loop formula in my analysis

G. Allegri giohappy at gmail.com
Wed Nov 19 23:03:14 CET 2008


Alessandro,
I suggest to read some startup tutorials before asking in ML.
Anyway you can do this:

 for(i in 1:500){
cp <- paste(sep="","centre_plot",i)
coordinates(cp) =~X+Y
proj4string(cp) <- CRS("+init=epsg:26911")
writeOGR(cp["Z"], paste(sep="",cp,".shp"), cp,driver="ESRI Shapefile")
}



2008/11/19 Alessandro <alessandro.montaghi at unifi.it>:
> Hi All,
>
> I read a lot about loop formula but this morning I tried to applied the loop
> for the following formulas
>
> I know it's easy for an expertise, but sorry I am working with R in this
> mounts and I change completely my GIS philosophy.
>
>
>
> Thanks for help
>
>
>
> give a coordinates attribution
>
>
>
> coordinates(centre_plot1) =~X+Y
>
> coordinates(centre_plot2) =~X+Y
>
> coordinates(centre_plot3) =~X+Y
>
> coordinates(centre_plot4) =~X+Y
>
> ......................
>
> .....................
>
> (I HAVE 500 plot)
>
>
>
> proj4string(centre_plot1) <- CRS("+init=epsg:26911")
>
> proj4string(centre_plot2) <- CRS("+init=epsg:26911")
>
> proj4string(centre_plot3) <- CRS("+init=epsg:26911")
>
> proj4string(centre_plot4) <- CRS("+init=epsg:26911")
>
>
>
> writeOGR(centre_plot1 ["Z"], " centre_plot1.shp", " centre_plot1",
> driver="ESRI Shapefile")
>
> writeOGR(centre_plot2 ["Z"], " centre_plot2.shp", " centre_plot2",
> driver="ESRI Shapefile")
>
> writeOGR(centre_plot3 ["Z"], " centre_plot3.shp", " centre_plot3",
> driver="ESRI Shapefile")
>
> writeOGR(centre_plot4 ["Z"], " centre_plot4.shp", " centre_plot4",
> driver="ESRI Shapefile")
>
>
>
> Ale
>
>
>        [[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
>




More information about the R-sig-Geo mailing list