[R-sig-Geo] raster::raster from SpatialPixelsDataFrame object

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Jan 23 16:36:00 CET 2014



On 01/23/2014 04:17 PM, Agustin Lobo wrote:
> In order to convert a SpatialPixelsDataFrame object "m" into a raster I just do
> data(meuse.grid)
> m = SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")], data = meuse.grid)
> m at data <- data.frame(name="A",m at data)
> r <- raster(m)
> 
> but the actual values are taken from the first column as I'm not
> selecting the numeric field in
> the table.
> Is there a way to select the field as in rasterize?

you mean, like in:

r <- raster(m[3])

or

r <- raster(m["ffreq"])

?

> 
> r2 <- rasterize(x=m,y=r, field="dist")
> 
> It would make sense doing this in just one command.
> 
> Thanks
> 
> Agus
> 
> _______________________________________________
> 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
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140123/9af4455e/attachment.bin>


More information about the R-sig-Geo mailing list