On Mon, 30 Mar 2009, gianni lavaredo wrote:

Dear R user,

I have an ascii file (It's a raster in Arcmap) and I wish to import in R
to do some analisys. I am using like help

Zone_2644149 = readGDAL("Zone_2644149.asc")$band1
Zone_2644149.asc has GDAL driver AAIGrid
and has 246 rows and 381 columns

str(Zone_2644149)
num [1:93726] 35.1 34.7 35.2 35.9 31.2 ...

What about:

Zone_2644149 <- readGDAL("Zone_2644149.asc")
# to get a SpatialGridDataFrame (I think with a single band only for this # format; selecting $band1 just returns the data in band1
fullgrid(Zone_2644149) <- FALSE
# to drop the cells with NA to get a SpatialPixelsDataFrame
# or Zone_2644149 <- as(Zone_2644149, "SpatialPixelsDataFrame")

If you say summary(Zone_2644149) first, you can check whether coercing from SpatialGrid to SpatialPixels is justified by the number of NAs in band1.

Hope this helps,

Roger


but I need to have a SpatialPixelsDataFrame but SORRY I haven't idea how to
import as SpatialPixelsDataFrame

thanks Gianni

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [email protected]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to