Skip to content

problem with loop formula in my analysis

3 messages · G. Allegri, Kamran Safi

#
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>:
#
A correction.
cp["Z"] should be get(cp)[z], to evaluate the string to a variable name...

2008/11/19 G. Allegri <giohappy at gmail.com>: